diff --git a/.gitignore b/.gitignore index 782678f6..d26a382d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ bin/*.sh .classpath .settings/* .project +.vscode/ .idea/ *.iml *.ipr @@ -49,6 +50,7 @@ dotCMS/WEB-INF/classes/ libs/test build/ out/ +target/ dotCMS/WEB-INF/generated_web.xml dotCMS/WEB-INF/lib/*.jar dotCMS/WEB-INF/felix/bundle/dot.*.jar diff --git a/README.md b/README.md index 320f6431..4391a9a6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This project contains many examples on how dotCMS plugins can customize and extend dotCMS. The plugins use dotCMS's OSGi capabilities to extend and override dotCMS in different ways. These plugins all use gradle for building. In each sub directory, you can run -`./gradlew jar` which will build the plugin, which can then be uploaded into dotCMS. +`mvn clean jar` which will build the plugin, which can then be uploaded into dotCMS. If you are interested in seeing other working examples of plugins, you should visit dotcms's public plugin repo https://github.com/dotcms-plugins diff --git a/com.dotcms.3rd.party/README.md b/com.dotcms.3rd.party/README.md index d94175a9..031eedbf 100644 --- a/com.dotcms.3rd.party/README.md +++ b/com.dotcms.3rd.party/README.md @@ -5,7 +5,7 @@ This bundle plugin is an example of how to add 3rd party jars to a bundle plugin ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.3rd.party/build.gradle b/com.dotcms.3rd.party/build.gradle deleted file mode 100644 index 307409f0..00000000 --- a/com.dotcms.3rd.party/build.gradle +++ /dev/null @@ -1,122 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.3' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile fileTree(dir: 'src/main/resources/libs', include: '*.jar') - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - OSGI 3rd Party library example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.external.Activator', - 'Bundle-ClassPath' : "${classPathLibraries()}", - 'Import-Package': '!hirondelle.date4j.*,*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -/** - * Searches for jars inside the src/main/resources/libs folder, the returned list is used for the - * Bundle-ClassPath attribute. - * @return String with the list of jars inside the src/main/resources/libs folder or empty if the - * folder does not exist or it is empty. - */ -def classPathLibraries() { - - def bundleClassPath = ""; - fileTree("src/main/resources/libs").filter { it.isFile() }.each { bundleClassPath += "libs/" + it.name + "," } - - if (bundleClassPath != "") { - bundleClassPath = '.,' + bundleClassPath - } - - return bundleClassPath -} - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "OSGI 3rd Party library fragment" - bundleDescription = "dotCMS - OSGI 3rd Party library fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.3rd.party/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.3rd.party/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.3rd.party/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.3rd.party/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.3rd.party/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.3rd.party/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.3rd.party/gradlew b/com.dotcms.3rd.party/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.3rd.party/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.3rd.party/gradlew.bat b/com.dotcms.3rd.party/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.3rd.party/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.3rd.party/pom.xml b/com.dotcms.3rd.party/pom.xml new file mode 100644 index 00000000..637cfeff --- /dev/null +++ b/com.dotcms.3rd.party/pom.xml @@ -0,0 +1,80 @@ + + 4.0.0 + + com.dotcms + osgi-third-party-lib-example + 0.3 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + hirondelle.date4j + date4j + your.version + system + ${project.basedir}/src/main/resources/libs/date4j.jar + + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - OSGI 3rd Party library example + https://dotcms.com/ + com.dotmarketing.osgi.external.Activator + .,libs/* + !hirondelle.date4j.*,*;version=0 + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.2 + + + prepare-package + + copy-dependencies + + + ${project.build.directory}/libs + runtime + + + + + + + diff --git a/com.dotcms.actionlet/README.md b/com.dotcms.actionlet/README.md index 4cb3180f..8f142d85 100644 --- a/com.dotcms.actionlet/README.md +++ b/com.dotcms.actionlet/README.md @@ -5,7 +5,7 @@ This bundle plugin is an example of how to add dotcms WorkFlowActionlet classes ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.actionlet/build.gradle b/com.dotcms.actionlet/build.gradle deleted file mode 100644 index 9520f8fa..00000000 --- a/com.dotcms.actionlet/build.gradle +++ /dev/null @@ -1,103 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - OSGI Actionlet example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.actionlet.Activator', - 'Import-Package': '*;version=0' - ) - } -} - -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "dotCMS Actionlet fragment" - bundleDescription = "dotCMS - OSGI Actionlet example fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.actionlet/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.actionlet/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.actionlet/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.actionlet/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.actionlet/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.actionlet/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.actionlet/gradlew b/com.dotcms.actionlet/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.actionlet/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.actionlet/gradlew.bat b/com.dotcms.actionlet/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.actionlet/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.actionlet/pom.xml b/com.dotcms.actionlet/pom.xml new file mode 100644 index 00000000..f83b8e4b --- /dev/null +++ b/com.dotcms.actionlet/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + + com.dotcms + osgi-actionlet-example + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - OSGI Actionlet example + https://dotcms.com/ + com.dotmarketing.osgi.actionlet.Activator + * + + + + + + diff --git a/com.dotcms.aop/README.md b/com.dotcms.aop/README.md index 2de71e3d..5701030d 100644 --- a/com.dotcms.aop/README.md +++ b/com.dotcms.aop/README.md @@ -20,7 +20,7 @@ It will provide an appropiate connection, if needed and handle the commit, rollb ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.aop/build.gradle b/com.dotcms.aop/build.gradle deleted file mode 100644 index 2db0c2fa..00000000 --- a/com.dotcms.aop/build.gradle +++ /dev/null @@ -1,173 +0,0 @@ -import java.util.jar.JarFile - -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' - -group 'com.dotcms.aop' -version '0.2' - - -repositories { - maven { - url "http://repo.dotcms.com/artifactory/libs-release" - } -} - -apply plugin: 'java' -apply plugin: 'application' -apply plugin: 'osgi' -apply plugin: 'war' -apply plugin: 'eclipse' - -compileJava.enabled = false; - -project.ext { - aspectjVersion = '1.8.10' -} - -configurations { - ajc - provided - aspects - ajInpath -} - -task compileAjc(overwrite: true) { - - // Declare the output directory to enable uptodate checks - outputs.dir sourceSets.main.output.classesDir - - doLast{ - // Resolve the AspectJ compiler via dependencies of the ajc configuration - ant.taskdef( resource:"org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: configurations.ajc.asPath) - ant.iajc(source:"1.8", target:"1.8", - destDir:sourceSets.main.output.classesDir, - maxmem:"512m", - fork:"true", - // Jars containing aspects to be woven should be declared in the aspects configuration - aspectPath:configurations.aspects?.asPath, - // Jars containing classes where aspects should be woven into should be declared in the ajInpath configuration - inpath:configurations.ajInpath?.asPath, - // Define the compile classpath to include a deps of a 'provided' configuration - classpath:configurations.compile.asPath + configurations.provided.asPath){ - - sourceroots{ - sourceSets.main.java.srcDirs.each{ - // The aspectJ compiler does not like nonexisting source roots, so check if they exist - if (it.exists()) { - pathelement(location:it.absolutePath) - } - } - } - - } - } -} - -// Link the compileAjc task into the dependency chain -processResources.dependsOn(compileAjc) - -dependencies { - - ajc "org.aspectj:aspectjtools:1.8.10" - providedCompile "org.aspectj:aspectjrt:1.8.10" - providedCompile (group: 'com.dotcms', name: 'dotcms', version: '23.06'){ - transitive = true - } - aspects (group: 'com.dotcms', name: 'dotcms', version: '23.06') - - providedCompile "javax.servlet:javax.servlet-api:3.1.0" -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - name = 'Osgi AOP class' - instruction 'Bundle-Vendor', 'dotcms' - instruction 'Bundle-Description', 'dotCMS - Osgi AOP class example' - instruction 'Bundle-DocURL', 'http://www.dotcms.com' - instruction 'Bundle-Activator', 'com.dotcms.plugin.aop.Activator' - instruction 'Import-Package', 'com.dotcms.plugin.aop.rest.*,' + - '*;version=0' - } -} - -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "dotCMS AOP class fragment" - bundleDescription = "dotCMS - Osgi AOP class fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} - diff --git a/com.dotcms.aop/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.aop/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.aop/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.aop/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.aop/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.aop/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.aop/gradlew b/com.dotcms.aop/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.aop/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.aop/gradlew.bat b/com.dotcms.aop/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.aop/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.aop/pom.xml b/com.dotcms.aop/pom.xml new file mode 100644 index 00000000..67de3e2c --- /dev/null +++ b/com.dotcms.aop/pom.xml @@ -0,0 +1,75 @@ + + 4.0.0 + + com.dotcms.aop + aop-example + 0.3 + bundle + + + UTF-8 + 11 + 11 + 1.8.10 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + org.aspectj + aspectjrt + ${aspectj.version} + provided + + + junit + junit-dep + 4.10 + test + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - AOP Example + https://dotcms.com/ + com.dotcms.aop.Activator + * + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + + + + + diff --git a/com.dotcms.aop/settings.gradle b/com.dotcms.aop/settings.gradle deleted file mode 100644 index f6c53ad3..00000000 --- a/com.dotcms.aop/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -rootProject.name = 'aop-example' - diff --git a/com.dotcms.app.example/.gitignore b/com.dotcms.app.example/.gitignore deleted file mode 100644 index 2a68cbf9..00000000 --- a/com.dotcms.app.example/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/bin/ -/build/ -/.settings/ -/.gradle/ -src/main/resources/libs/ -src/main/resources/libs -src/main/resources/GeoIP2-City.mmdb diff --git a/com.dotcms.app.example/build.gradle b/com.dotcms.app.example/build.gradle deleted file mode 100644 index bab1a4ee..00000000 --- a/com.dotcms.app.example/build.gradle +++ /dev/null @@ -1,104 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.3' - -repositories { - maven { url "https://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } - - testCompile group: 'junit', name: 'junit-dep', version: '4.10' -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - App and Secrets Example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotcms.osgi.app.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "dotCMS - App fragment" - bundleDescription = "dotCMS - App fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.app.example/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.app.example/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index a48dc715..00000000 Binary files a/com.dotcms.app.example/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.app.example/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.app.example/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 8c8d44d6..00000000 --- a/com.dotcms.app.example/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Thu Apr 01 13:52:45 CST 2021 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip diff --git a/com.dotcms.app.example/gradlew b/com.dotcms.app.example/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.app.example/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.app.example/gradlew.bat b/com.dotcms.app.example/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.app.example/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.app.example/pom.xml b/com.dotcms.app.example/pom.xml new file mode 100644 index 00000000..44cafb12 --- /dev/null +++ b/com.dotcms.app.example/pom.xml @@ -0,0 +1,68 @@ + + 4.0.0 + + com.dotcms + app-and-secrets-example + 0.3 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + junit + junit-dep + 4.10 + test + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - App and Secrets Example + https://dotcms.com/ + com.dotcms.osgi.app.Activator + * + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + + + + diff --git a/com.dotcms.content.validation/README.md b/com.dotcms.content.validation/README.md index c7fd3002..3a770e0d 100644 --- a/com.dotcms.content.validation/README.md +++ b/com.dotcms.content.validation/README.md @@ -5,7 +5,7 @@ This plugin is an example of how you can add custom validation to content using ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.content.validation/bin/main/.gitignore b/com.dotcms.content.validation/bin/main/.gitignore deleted file mode 100644 index c2d9872a..00000000 --- a/com.dotcms.content.validation/bin/main/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/com/ diff --git a/com.dotcms.content.validation/build.gradle b/com.dotcms.content.validation/build.gradle deleted file mode 100644 index 16315e35..00000000 --- a/com.dotcms.content.validation/build.gradle +++ /dev/null @@ -1,103 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "https://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - Validation Actionlet', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotcms.content.validation.Activator', - 'Import-Package': '*;version=0' - ) - } -} - -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "dotCMS Actionlet fragment" - bundleDescription = "dotCMS - OSGI Actionlet example fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.content.validation/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.content.validation/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.content.validation/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.content.validation/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.content.validation/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.content.validation/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.content.validation/gradlew b/com.dotcms.content.validation/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.content.validation/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.content.validation/gradlew.bat b/com.dotcms.content.validation/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.content.validation/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.content.validation/pom.xml b/com.dotcms.content.validation/pom.xml new file mode 100644 index 00000000..e9324d71 --- /dev/null +++ b/com.dotcms.content.validation/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + + com.dotcms + validation-actionlet-example + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - Validation Actionlet + https://dotcms.com/ + com.dotcms.content.validation.Activator + * + + + + + + diff --git a/com.dotcms.custom.spring/README.md b/com.dotcms.custom.spring/README.md deleted file mode 100644 index fac35f6c..00000000 --- a/com.dotcms.custom.spring/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# README - -### This plugin uses the HTTP Servlet Service that is no longer supported in dotCMS as of version 5.1.6. The code needs to be updated to use a Web Inteceptor rather than rely on registering a servlet as a spring controller. - -This bundle plugin is an example of how to add Spring support to a bundle plugin, creates and registers a simple Spring Controller using a different Spring version that the one shipped with dotCMS in order to extend the reach of this example. - -## How to build this example - -To install all you need to do is build the JAR. to do this run -`./gradlew jar` - -This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar - -* **To install this bundle:** - - Copy the bundle jar files inside the Felix OSGI container (*dotCMS/felix/load*). - - OR - - Upload the bundle jars files using the dotCMS UI (*CMS Admin->Dynamic Plugins->Upload Plugin*). - -* **To uninstall this bundle:** - - Remove the bundle jars files from the Felix OSGI container (*dotCMS/felix/load*). - - OR - - Undeploy the bundle jars using the dotCMS UI (*CMS Admin->Dynamic Plugins->Undeploy*). - -## How to create a bundle plugin with Spring support - -In order to create this OSGI plugin, you must create a `META-INF/MANIFEST` to be inserted into OSGI jar. -This file is being created for you by Gradle. If you need you can alter our config for this but in general our out of the box config should work. -The Gradle plugin uses BND to generate the Manifest. The main reason you need to alter the config is when you need to exclude a package you are including on your Bundle-ClassPath - -If you are building the MANIFEST on your own or desire more info on it below is a description of what is required in this MANIFEST you must specify (see template plugin): - -``` - Bundle-Name: The name of your bundle - Bundle-SymbolicName: A short an unique name for the bundle - Bundle-Activator: Package and name of your Activator class (example: com.dotmarketing.osgi.custom.spring.Activator) - Bundle-ClassPath: The Bundle-ClassPath specifies where to load classes and jars from from the bundle. - Export-Package: Declares the packages that are visible outside the plugin. Any package not declared here has visibility only within the bundle. - Import-Package: This is a comma separated list of the names of packages to import. In this list there must be the packages that you are using inside your osgi bundle plugin and are exported and exposed by the dotCMS runtime. -``` - -## Beware (!) - -In order to work inside the Apache Felix OSGI runtime, the import and export directive must be bidirectional, there are two ways to accomplish this: - -* **Exported Packages** - - The dotCMS must declare the set of packages that will be available to the OSGI plugins by changing the file: *dotCMS/WEB-INF/felix/osgi-extra.conf*. -This is possible also using the dotCMS UI (*CMS Admin->Dynamic Plugins->Exported Packages*). - - Only after that exported packages are defined in this list, a plugin can Import the packages to use them inside the OSGI blundle. - -* **Fragment** - - A Bundle fragment, is a bundle whose contents are made available to another bundles exporting 3rd party libraries from dotCMS. -One notable difference is that fragments do not participate in the lifecycle of the bundle, and therefore cannot have an Bundle-Activator. -As it not contain a Bundle-Activator a fragment cannot be started so after deploy it will have its state as Resolved and NOT as Active as a normal bundle plugin. - ---- -## Components - -### com.dotmarketing.osgi.custom.spring.ExampleController - -Simple annotated Spring Controller - -### com.dotmarketing.osgi.custom.spring.CustomViewResolver - -Custom implementation of an Spring ViewResolver. - -### com.dotmarketing.osgi.custom.spring.CustomView - -Custom implementation of an Spring View. - -### example-servlet.xml - -Inside the *com.dotcms.custom.spring/src/main/resources/spring* folder is an Standard Spring configuration file where basically we enabled the support for anntotation-driven controllers and the Spring component-scan functionality. - -### Activator - -This bundle activator extends from *com.dotmarketing.osgi.GenericBundleActivator* and implements `BundleActivator.start()`. -Will manually register making use of the class *DispatcherServlet* our spring configuration file *spring/example-servlet.xml*. - -* PLEASE note the `publishBundleServices( context )` call, this call is MANDATORY (!) as it will allow us to share resources between the bundle, the host container (dotCMS) and the Spring context. - ---- -## Testing - -The Spring controller is registered under the url pattern **"/spring"** can be test it running and assuming your dotCMS url is *localhost:8080*: - -* [http://localhost:8080/app/spring/examplecontroller/](http://localhost:8080/app/spring/examplecontroller/) -* [http://localhost:8080/app/spring/examplecontroller/Testing](http://localhost:8080/app/spring/examplecontroller/Testing) diff --git a/com.dotcms.custom.spring/build.gradle b/com.dotcms.custom.spring/build.gradle deleted file mode 100644 index 8ecf6a23..00000000 --- a/com.dotcms.custom.spring/build.gradle +++ /dev/null @@ -1,164 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.3' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -configurations { - pluginLibs -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } - //Resolve dependencies. These jars can be downloaded from our Maven Repo - //In case you want to create a Controller using other Spring version, - //just change the version Attribute. - pluginLibs group: 'org.springframework', name: 'spring-webmvc', version: '4.3.9.RELEASE' - pluginLibs group: 'org.apache.commons', name: 'commons-collections4', version: '4.0' - pluginLibs group: 'org.apache.commons', name: 'commons-io', version: '1.3.2' - pluginLibs group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2' - pluginLibs group: 'org.slf4j', name:'slf4j-api', version:'1.7.7' - pluginLibs group: 'org.slf4j', name:'slf4j-simple', version: '1.7.7' - pluginLibs group: 'org.slf4j', name:'jcl-over-slf4j', version:'1.7.1' - pluginLibs group: 'sax', name: 'sax', version: '2.0.1' - pluginLibs group: 'xml-apis', name: 'xml-apis', version: '1.4.01' - pluginLibs group: 'xalan', name: 'xalan', version: '2.7.2' - pluginLibs group: 'xerces', name: 'xercesImpl', version: '2.11.0' -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - Spring OSGi Example providing its own Spring for dotcms', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.custom.spring.Activator', - 'Bundle-ClassPath' : "${classPathLibraries()}", - 'Import-Package': ''' - bsh;resolution:=optional, - javax.servlet;version=0, - javax.servlet.jsp.*;resolution:=optional, - javax.servlet.annotation;version=0, - javax.servlet.http;version=0, - javax.naming;version=0, - org.apache.velocity.*, - com.dotmarketing.osgi.*, - com.dotmarketing.util.*; - com.dotmarketing.filters.*, - com.dotmarketing.loggers.*, - org.apache.logging.log4j.core;version=0, - org.apache.logging.log4j;version=0, - javax.management.*, - org.apache.felix.http.api.*, - org.osgi.framework.*, - ''' - ) - } -} - -task copyToLib(type: Copy) { - into "src/main/resources/libs" - from configurations.pluginLibs -} - -jar.dependsOn copyToLib -jar.finalizedBy 'fragmentJar' - -/** - * Searches for jars inside the src/main/resources/libs folder, the returned list is used for the - * Bundle-ClassPath attribute. - * @return String with the list of jars inside the src/main/resources/libs folder or empty if the - * folder does not exist or it is empty. - */ -def classPathLibraries() { - - def bundleClassPath = ""; - fileTree("src/main/resources/libs").filter { it.isFile() }.each { bundleClassPath += "libs/" + it.name + "," } - - if (bundleClassPath != "") { - bundleClassPath = '.,' + bundleClassPath - } - - return bundleClassPath -} - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "dotCMS Custom Spring OSGi fragment" - bundleDescription = "dotCMS - Spring OSGi Example providing its own Spring for dotcms fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -tasks.copyToLib.execute() -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.custom.spring/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.custom.spring/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 736fb7d3..00000000 Binary files a/com.dotcms.custom.spring/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.custom.spring/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.custom.spring/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index fb7ef980..00000000 --- a/com.dotcms.custom.spring/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip diff --git a/com.dotcms.custom.spring/gradlew b/com.dotcms.custom.spring/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.custom.spring/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.custom.spring/gradlew.bat b/com.dotcms.custom.spring/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.custom.spring/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.custom.spring/src/main/java/com/dotmarketing/osgi/custom/spring/Activator.java b/com.dotcms.custom.spring/src/main/java/com/dotmarketing/osgi/custom/spring/Activator.java deleted file mode 100644 index e6fe814e..00000000 --- a/com.dotcms.custom.spring/src/main/java/com/dotmarketing/osgi/custom/spring/Activator.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.dotmarketing.osgi.custom.spring; - -import com.dotmarketing.filters.CMSFilter; -import com.dotmarketing.loggers.Log4jUtil; -import com.dotmarketing.osgi.GenericBundleActivator; -import org.apache.felix.http.api.ExtHttpService; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.core.LoggerContext; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.springframework.web.servlet.DispatcherServlet; - -/** - * @author Jonathan Gamba - * Date: 6/18/12 - */ -public class Activator extends GenericBundleActivator { - - private LoggerContext pluginLoggerContext; - - @SuppressWarnings ("unchecked") - public void start(BundleContext context) throws Exception { - - //Initializing log4j... - LoggerContext dotcmsLoggerContext = Log4jUtil.getLoggerContext(); - //Initialing the log4j context of this plugin based on the dotCMS logger context - pluginLoggerContext = (LoggerContext) LogManager - .getContext(this.getClass().getClassLoader(), - false, - dotcmsLoggerContext, - dotcmsLoggerContext.getConfigLocation()); - - //Initializing services... - initializeServices( context ); - - //Getting the current thread class loader - ClassLoader currentContextClassLoader = Thread.currentThread().getContextClassLoader(); - - //Service reference to ExtHttpService that will allows to register servlets and filters - ServiceReference sRef = context.getServiceReference(ExtHttpService.class.getName()); - if ( sRef != null ) { - - //Publish bundle services - publishBundleServices( context );//This call will make the elements of the bundle, like our controller class available to the Spring context - - ExtHttpService httpService = (ExtHttpService) context.getService(sRef); - try { - - /* - Work around for problems loading classes using third-party libraries in an OSGi bundle. - The way that third-party libraries load their classes is out of your control. - In most cases works properly, if the third-party library uses the normal classloader from the bundle. - But sometimes a library, like Spring could try to load a class like the following: - Thread.currentThread().getContextClassLoader().loadClass("mypackage.FooBar"); - By default, the Thread context class loader is not aware of OSGi and - as result doesn't see any of the classes imported in the bundle. That's why loading the class fails. - References: - https://helpx.adobe.com/experience-manager/kb/OsgiClassLoading3Party.html - https://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi - */ - Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); - - DispatcherServlet dispatcherServlet = new DispatcherServlet(); - dispatcherServlet.setContextConfigLocation( "spring/example-servlet.xml" ); - httpService.registerServlet("/spring", dispatcherServlet, null, null); - } catch ( Exception e ) { - e.printStackTrace(); - } finally { - //Setting back the original class loader to the current thread - Thread.currentThread().setContextClassLoader(currentContextClassLoader); - } - CMSFilter.addExclude( "/app/spring" ); - } - } - - public void stop ( BundleContext context ) throws Exception { - - CMSFilter.removeExclude( "/app/spring" ); - - //Unpublish bundle services - unregisterServices( context ); - - //Shutting down log4j in order to avoid memory leaks - Log4jUtil.shutdown(pluginLoggerContext); - } - -} \ No newline at end of file diff --git a/com.dotcms.custom.spring/src/main/java/com/dotmarketing/osgi/custom/spring/CustomView.java b/com.dotcms.custom.spring/src/main/java/com/dotmarketing/osgi/custom/spring/CustomView.java deleted file mode 100644 index 2fb591f4..00000000 --- a/com.dotcms.custom.spring/src/main/java/com/dotmarketing/osgi/custom/spring/CustomView.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.dotmarketing.osgi.custom.spring; - -import com.dotmarketing.filters.Constants; -import com.dotmarketing.util.VelocityUtil; -import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.velocity.VelocityContext; -import org.springframework.web.servlet.View; - -/** - * Copy of the dotCMS View {@link com.dotcms.spring.web.DotView} in order - * to use our custom spring version and not the one use it by dotCMS. - * - * @author Jonathan Gamba - * Date: 4/15/13 - * @see com.dotcms.spring.web.DotView - */ -public class CustomView implements View { - - String pagePath; - - public CustomView ( String pagePath ) { - super(); - this.pagePath = pagePath; - } - - - public String getContentType () { - return null; - } - - public void render ( Map map, HttpServletRequest request, HttpServletResponse response ) throws Exception { - - // get the VelocityContext - VelocityContext ctx = VelocityUtil.getWebContext( request, response ); - - if ( !pagePath.startsWith( "redirect:" ) ) { - // add the Spring map to the context - for ( String x : map.keySet() ) { - ctx.put( x, map.get( x ) ); - } - - // add the context to the request.attr where it will be picked up and used by the VelocityServlet - request.setAttribute( com.dotcms.rendering.velocity.Constants.VELOCITY_CONTEXT, ctx ); - // override the page path - request.setAttribute( Constants.CMS_FILTER_URI_OVERRIDE, pagePath ); - - request.getRequestDispatcher( "/servlets/VelocityServlet" ).forward( request, response ); - } else { - pagePath = pagePath.replaceFirst( "redirect:", "" ); - response.sendRedirect( pagePath ); - } - } - -} \ No newline at end of file diff --git a/com.dotcms.custom.spring/src/main/java/com/dotmarketing/osgi/custom/spring/CustomViewResolver.java b/com.dotcms.custom.spring/src/main/java/com/dotmarketing/osgi/custom/spring/CustomViewResolver.java deleted file mode 100644 index aee59248..00000000 --- a/com.dotcms.custom.spring/src/main/java/com/dotmarketing/osgi/custom/spring/CustomViewResolver.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.dotmarketing.osgi.custom.spring; - -import org.springframework.web.servlet.View; -import org.springframework.web.servlet.ViewResolver; - -import java.util.Locale; - -/** - * Copy of the dotCMS ViewResolver {@link com.dotcms.spring.web.DotViewResolver} in order - * to use our custom spring version and not the one use it by dotCMS. - * - * @author Jonathan Gamba - * Date: 4/15/13 - * @see com.dotcms.spring.web.DotViewResolver - */ -public class CustomViewResolver implements ViewResolver { - - String prefix; - String suffix; - - public void setPrefix ( String prefix ) { - this.prefix = prefix; - } - - public void setSuffix ( String suffix ) { - this.suffix = suffix; - } - - public View resolveViewName ( String path, Locale locale ) throws Exception { - - if ( !path.startsWith( "redirect:" ) ) { - path = (prefix != null) - ? prefix + path - : path; - - path = (suffix != null) - ? path + suffix - : path; - } - - return new CustomView( path ); - } - -} \ No newline at end of file diff --git a/com.dotcms.custom.spring/src/main/java/com/dotmarketing/osgi/custom/spring/ExampleController.java b/com.dotcms.custom.spring/src/main/java/com/dotmarketing/osgi/custom/spring/ExampleController.java deleted file mode 100644 index 2584e130..00000000 --- a/com.dotcms.custom.spring/src/main/java/com/dotmarketing/osgi/custom/spring/ExampleController.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.dotmarketing.osgi.custom.spring; - -import com.dotmarketing.util.Logger; -import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; - -/** - * @author Jonathan Gamba - * Date: 4/15/13 - */ - -@EnableWebMvc -@Configuration -@RequestMapping ("/examplecontroller") -@Controller -public class ExampleController { - - @RequestMapping (value = "/", method = RequestMethod.GET) - public ModelAndView helloWorld () { - Logger.info( this.getClass(), "Received request to hello" ); - String myMessage = "Hello World, Spring 4.3.9.RELEASE and dotCMS!"; - // This will resolve to /application/spring/helloworld.html, and put the String myMessage in the map with key "message" - return new ModelAndView( "helloworld", "message", myMessage ); - } - - - @RequestMapping (value = "/{userName}", method = RequestMethod.GET) - public String getHello ( @PathVariable String userName, Model model ) { - - Logger.info( this.getClass(), "Received request to hello user" ); - - // set the message - String aMessage = (userName != null) - ? "Hello EDIT " + userName + ", welcome to Spring 4.3.9.RELEASE and dotCMS! " - : "Hello Total Stranger, welcome to Spring 4.3.9.RELEASE and dotCMS! "; - - // Attach message to the Model - model.addAttribute( "message", aMessage ); - - // This will resolve to /application/spring/helloworld.html - return "helloworld"; - } - -} diff --git a/com.dotcms.custom.spring/src/main/resources/spring/example-servlet.xml b/com.dotcms.custom.spring/src/main/resources/spring/example-servlet.xml deleted file mode 100644 index 9825aa82..00000000 --- a/com.dotcms.custom.spring/src/main/resources/spring/example-servlet.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/com.dotcms.dynamic.skeleton/README.md b/com.dotcms.dynamic.skeleton/README.md index 1095183c..7498d192 100644 --- a/com.dotcms.dynamic.skeleton/README.md +++ b/com.dotcms.dynamic.skeleton/README.md @@ -3,7 +3,7 @@ ## How to build an OSGi project To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.dynamic.skeleton/build.gradle b/com.dotcms.dynamic.skeleton/build.gradle deleted file mode 100644 index e008d20d..00000000 --- a/com.dotcms.dynamic.skeleton/build.gradle +++ /dev/null @@ -1,120 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -// Since dotCMS 3.x always use Java 8 -sourceCompatibility = '1.8' - -// Plugin version -version = '0.2' - -// Repositories -// reference to "artifactory" our oficial repository -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -configurations { - osgiLibs -} - -// Dependencies list -dependencies { - // include all jars within the resource libs - compile fileTree(dir: 'src/main/resources/libs', include: '*.jar') - // Using all jar from artifactory part of the dotcms group - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// - -// gradle task creates the jar for the OSGi bundle plugin -// replace and -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': '', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': '.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -// gradle task creates the jar for the OSGi bundle fragment plugin -// replace and -ext { - bundleName = "" - bundleDescription = "" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.dynamic.skeleton/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.dynamic.skeleton/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.dynamic.skeleton/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.dynamic.skeleton/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.dynamic.skeleton/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.dynamic.skeleton/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.dynamic.skeleton/gradlew b/com.dotcms.dynamic.skeleton/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.dynamic.skeleton/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.dynamic.skeleton/gradlew.bat b/com.dotcms.dynamic.skeleton/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.dynamic.skeleton/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.dynamic.skeleton/pom.xml b/com.dotcms.dynamic.skeleton/pom.xml new file mode 100644 index 00000000..f011622e --- /dev/null +++ b/com.dotcms.dynamic.skeleton/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.dotcms + custom-osgi-plugin + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + + https://dotcms.com/ + + * + + + + + + + + diff --git a/com.dotcms.fixasset/README.md b/com.dotcms.fixasset/README.md index fafab34f..e14465b7 100644 --- a/com.dotcms.fixasset/README.md +++ b/com.dotcms.fixasset/README.md @@ -12,7 +12,7 @@ Example use cases: ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.fixasset/build.gradle b/com.dotcms.fixasset/build.gradle deleted file mode 100644 index b452a3f4..00000000 --- a/com.dotcms.fixasset/build.gradle +++ /dev/null @@ -1,103 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - OSGI FixAsset example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotcms.osgi.fixasset.Activator', - 'DynamicImport-Package': '*', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "dotCMS OSGI FixAsset fragment" - bundleDescription = "dotCMS - OSGI FixAsset fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.fixasset/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.fixasset/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.fixasset/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.fixasset/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.fixasset/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.fixasset/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.fixasset/gradlew b/com.dotcms.fixasset/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.fixasset/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.fixasset/gradlew.bat b/com.dotcms.fixasset/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.fixasset/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.fixasset/pom.xml b/com.dotcms.fixasset/pom.xml new file mode 100644 index 00000000..793f1511 --- /dev/null +++ b/com.dotcms.fixasset/pom.xml @@ -0,0 +1,54 @@ + + 4.0.0 + + com.dotcms + osgi-fixasset-example + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - OSGI FixAsset example + https://dotcms.com/ + com.dotcms.osgi.fixasset.Activator + * + * + + + + + + diff --git a/com.dotcms.fragment/INSTALL.txt b/com.dotcms.fragment/INSTALL.txt deleted file mode 100644 index a546995f..00000000 --- a/com.dotcms.fragment/INSTALL.txt +++ /dev/null @@ -1,29 +0,0 @@ - -INSTALL -------- - -In order to install this bundle: - -1) If you are running from source, make sure you have built and deployed the dotCMS - BEFORE trying to build this plugin. To do this, from the ROOT of dotCMS, execute the - "deploy" task of the build.xml ant file to create the standard dotcms_xx.jar file, e.g. - - ant deploy - - This will build the monolithic dotCMS .jar with the libraries needed to build OSGi plugins - and place it in the dotCMS/WEB-INF/lib directory. - -2) From this directory (ROOT of the plugin), execute the "build" task of the build.xml ant - file to create the bundle jar file. - -To install this bundle: - - 1) Copy the bundle jar file inside the Felix OSGI container (dotCMS/felix/load). - OR - 2) Upload the bundle jar file using the dotCMS UI (CMS Admin->Dynamic Plugins->Upload Plugin). - -To uninstall this bundle: - - 1) Remove the bundle jar file from the Felix OSGI container (dotCMS/felix/load). - OR - 2) Undeploy the bundle using the dotCMS UI (CMS Admin->Dynamic Plugins->Undeploy). diff --git a/com.dotcms.fragment/META-INF/MANIFEST.MF b/com.dotcms.fragment/META-INF/MANIFEST.MF deleted file mode 100644 index 8ec2ce1e..00000000 --- a/com.dotcms.fragment/META-INF/MANIFEST.MF +++ /dev/null @@ -1,8 +0,0 @@ -Bundle-ManifestVersion: 2 -Bundle-Name: System extra packages -Bundle-SymbolicName: fragment.system.extra.packages -Bundle-Version: 1.0 -Bundle-Description: Bundle exporting 3rdparty libs -Fragment-Host: system.bundle; extension:=framework -Export-Package: com.dotmarketing.portlets.structure.factories, - com.dotmarketing.common.db diff --git a/com.dotcms.fragment/README.txt b/com.dotcms.fragment/README.txt deleted file mode 100644 index ceb96508..00000000 --- a/com.dotcms.fragment/README.txt +++ /dev/null @@ -1,34 +0,0 @@ - -README ------- - -This bundle plugin is an example of how to add a simple fragment bundle that can be use it to export 3rd party libraries - -How to create a bundle fragment plugin -------------------------------------------- - --- -In order to add a fragment OSGI bundle plugin, you must write the META-INF/MANIFEST -to be inserted into the OSGI jar. - -In this MANIFEST you must specify (see template plugin): - -Bundle-Name: The name of your fragment - -Bundle-SymbolicName: A short an unique name for the fragment - -Fragment-Host: system.bundle; extension:=framework - -Export-Package: This is a comma separated list of package's name. - In this list there must be the packages that you want to make - available for other bundles. - --- --- --- -Fragment bundles ---------- - -A Bundle fragment, is a bundle whose contents are made available to another bundles exporting 3rd party libraries. -One notable difference is that fragments do not participate in the lifecycle of the bundle, and therefore cannot have an Bundle-Activator. -As it not contain a Bundle-Activator a fragment cannot be started so after deploy it will have its state as Resolved and NOT as Active as a normal bundle plugin. diff --git a/com.dotcms.fragment/build.xml b/com.dotcms.fragment/build.xml deleted file mode 100644 index b2d79a41..00000000 --- a/com.dotcms.fragment/build.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/com.dotcms.hooks.pubsub/README.md b/com.dotcms.hooks.pubsub/README.md index 8e582669..7dd47be4 100644 --- a/com.dotcms.hooks.pubsub/README.md +++ b/com.dotcms.hooks.pubsub/README.md @@ -7,7 +7,7 @@ and send a message to others nodes. ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.hooks.pubsub/build.gradle b/com.dotcms.hooks.pubsub/build.gradle deleted file mode 100644 index aaab3883..00000000 --- a/com.dotcms.hooks.pubsub/build.gradle +++ /dev/null @@ -1,102 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - OSGI Hooks example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.hooks.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "OSGI Hooks example fragment" - bundleDescription = "dotCMS - OSGI Hooks example fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = { importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.hooks.pubsub/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.hooks.pubsub/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.hooks.pubsub/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.hooks.pubsub/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.hooks.pubsub/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.hooks.pubsub/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.hooks.pubsub/gradlew b/com.dotcms.hooks.pubsub/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.hooks.pubsub/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.hooks.pubsub/gradlew.bat b/com.dotcms.hooks.pubsub/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.hooks.pubsub/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.hooks.pubsub/pom.xml b/com.dotcms.hooks.pubsub/pom.xml new file mode 100644 index 00000000..18d00342 --- /dev/null +++ b/com.dotcms.hooks.pubsub/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + + com.dotcms + osgi-hooks-pubsub-example + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - OSGI Hooks Pubsub example + https://dotcms.com/ + com.dotmarketing.osgi.hooks.Activator + * + + + + + + diff --git a/com.dotcms.hooks.validations/README.md b/com.dotcms.hooks.validations/README.md index ffaec498..ef50a5dd 100644 --- a/com.dotcms.hooks.validations/README.md +++ b/com.dotcms.hooks.validations/README.md @@ -20,7 +20,7 @@ You can use them just as a reference to create your own ones or just modified th ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.hooks.validations/build.gradle b/com.dotcms.hooks.validations/build.gradle deleted file mode 100644 index e7a75a15..00000000 --- a/com.dotcms.hooks.validations/build.gradle +++ /dev/null @@ -1,102 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - OSGI Hooks Validations', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.hooks.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "OSGI Hooks Validations" - bundleDescription = "dotCMS - OSGI Hooks Validations" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = { importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.hooks.validations/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.hooks.validations/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.hooks.validations/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.hooks.validations/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.hooks.validations/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.hooks.validations/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.hooks.validations/gradlew b/com.dotcms.hooks.validations/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.hooks.validations/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.hooks.validations/gradlew.bat b/com.dotcms.hooks.validations/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.hooks.validations/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.hooks.validations/pom.xml b/com.dotcms.hooks.validations/pom.xml new file mode 100644 index 00000000..2f7c7042 --- /dev/null +++ b/com.dotcms.hooks.validations/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + + com.dotcms + osgi-hooks-validations + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - OSGI Hooks Validations + https://dotcms.com/ + com.dotmarketing.osgi.hooks.Activator + * + + + + + + diff --git a/com.dotcms.hooks/README.md b/com.dotcms.hooks/README.md index 1805b9a1..cb89fb4f 100644 --- a/com.dotcms.hooks/README.md +++ b/com.dotcms.hooks/README.md @@ -14,7 +14,7 @@ To see all the methods that can be overridden, see the interfaces: ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.hooks/build.gradle b/com.dotcms.hooks/build.gradle deleted file mode 100644 index aaab3883..00000000 --- a/com.dotcms.hooks/build.gradle +++ /dev/null @@ -1,102 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - OSGI Hooks example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.hooks.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "OSGI Hooks example fragment" - bundleDescription = "dotCMS - OSGI Hooks example fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = { importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.hooks/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.hooks/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.hooks/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.hooks/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.hooks/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.hooks/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.hooks/gradlew b/com.dotcms.hooks/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.hooks/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.hooks/gradlew.bat b/com.dotcms.hooks/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.hooks/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.hooks/pom.xml b/com.dotcms.hooks/pom.xml new file mode 100644 index 00000000..157115a0 --- /dev/null +++ b/com.dotcms.hooks/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + + com.dotcms + osgi-hooks-example + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - OSGI Hooks example + https://dotcms.com/ + com.dotmarketing.osgi.hooks.Activator + * + + + + + + diff --git a/com.dotcms.job/.gitignore b/com.dotcms.job/.gitignore deleted file mode 100644 index ae3c1726..00000000 --- a/com.dotcms.job/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/bin/ diff --git a/com.dotcms.job/README.md b/com.dotcms.job/README.md index 05fa0a16..aac5b738 100644 --- a/com.dotcms.job/README.md +++ b/com.dotcms.job/README.md @@ -5,7 +5,7 @@ This bundle plugin is an example of how to Schedule Quartz Jobs using an OSGI bu ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.job/build.gradle b/com.dotcms.job/build.gradle deleted file mode 100644 index 26acf8eb..00000000 --- a/com.dotcms.job/build.gradle +++ /dev/null @@ -1,102 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - Dynamic Quartz Jobs example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.job.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "Dynamic Quartz Jobs example fragment" - bundleDescription = "dotCMS - Dynamic Quartz Jobs example fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = { importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.job/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.job/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.job/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.job/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.job/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.job/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.job/gradlew b/com.dotcms.job/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.job/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.job/gradlew.bat b/com.dotcms.job/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.job/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.job/pom.xml b/com.dotcms.job/pom.xml new file mode 100644 index 00000000..1ac6a9a8 --- /dev/null +++ b/com.dotcms.job/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + + com.dotcms + dynamic-quartz-jobs-example + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - Dynamic Quartz Jobs example + https://dotcms.com/ + com.dotmarketing.osgi.job.Activator + * + + + + + + diff --git a/com.dotcms.override/README.md b/com.dotcms.override/README.md index 77e70976..c4b6d0d9 100644 --- a/com.dotcms.override/README.md +++ b/com.dotcms.override/README.md @@ -5,7 +5,7 @@ This bundle plugin is an example of how to override dotCMS classes with our bund ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.override/build.gradle b/com.dotcms.override/build.gradle deleted file mode 100644 index a444eddd..00000000 --- a/com.dotcms.override/build.gradle +++ /dev/null @@ -1,103 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - Override class example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.override.Activator', - 'Override-Classes': 'com.dotmarketing.portlets.folders.model.Folder', - 'Import-Package': '!com.dotmarketing.portlets.folders.model,*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "dotCMS Override fragment" - bundleDescription = "dotCMS - Override fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.override/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.override/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.override/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.override/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.override/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.override/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.override/gradlew b/com.dotcms.override/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.override/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.override/gradlew.bat b/com.dotcms.override/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.override/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.override/pom.xml b/com.dotcms.override/pom.xml new file mode 100644 index 00000000..1a08a656 --- /dev/null +++ b/com.dotcms.override/pom.xml @@ -0,0 +1,54 @@ + + 4.0.0 + + com.dotcms + override-class-example + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - Override class example + https://dotcms.com/ + com.dotmarketing.osgi.override.Activator + com.dotmarketing.portlets.folders.model.Folder + !com.dotmarketing.portlets.folders.model,*;version=0 + + + + + + diff --git a/com.dotcms.portlet/README.md b/com.dotcms.portlet/README.md index 9c512540..77ff6028 100644 --- a/com.dotcms.portlet/README.md +++ b/com.dotcms.portlet/README.md @@ -9,7 +9,7 @@ This example includes the code to create three different types of Portlets, all ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.portlet/build.gradle b/com.dotcms.portlet/build.gradle deleted file mode 100644 index 2ce1fd15..00000000 --- a/com.dotcms.portlet/build.gradle +++ /dev/null @@ -1,102 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - Osgi Portlets example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.portlet.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "Osgi Portlets fragment" - bundleDescription = "dotCMS - Osgi Portlets fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.portlet/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.portlet/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.portlet/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.portlet/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.portlet/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.portlet/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.portlet/gradlew b/com.dotcms.portlet/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.portlet/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.portlet/gradlew.bat b/com.dotcms.portlet/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.portlet/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.portlet/pom.xml b/com.dotcms.portlet/pom.xml new file mode 100644 index 00000000..611a0f17 --- /dev/null +++ b/com.dotcms.portlet/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + + com.dotcms + osgi-portlets-example + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - Osgi Portlets example + https://dotcms.com/ + com.dotmarketing.osgi.portlet.Activator + * + + + + + + diff --git a/com.dotcms.pushpublish.listener/README.md b/com.dotcms.pushpublish.listener/README.md index 94ba6cd9..74096048 100644 --- a/com.dotcms.pushpublish.listener/README.md +++ b/com.dotcms.pushpublish.listener/README.md @@ -3,7 +3,7 @@ ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.pushpublish.listener/build.gradle b/com.dotcms.pushpublish.listener/build.gradle deleted file mode 100644 index dfe8d001..00000000 --- a/com.dotcms.pushpublish.listener/build.gradle +++ /dev/null @@ -1,102 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - OSGI PP Event Listener example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotcms.pushpublish.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "OSGI PP Event Listener fragment" - bundleDescription = "dotCMS - OSGI PP Event Listener fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.pushpublish.listener/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.pushpublish.listener/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.pushpublish.listener/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.pushpublish.listener/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.pushpublish.listener/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.pushpublish.listener/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.pushpublish.listener/gradlew b/com.dotcms.pushpublish.listener/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.pushpublish.listener/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.pushpublish.listener/gradlew.bat b/com.dotcms.pushpublish.listener/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.pushpublish.listener/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.pushpublish.listener/pom.xml b/com.dotcms.pushpublish.listener/pom.xml new file mode 100644 index 00000000..da6aedc4 --- /dev/null +++ b/com.dotcms.pushpublish.listener/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + + com.dotcms + osgi-pp-event-listener-example + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - OSGI PP Event Listener example + https://dotcms.com/ + com.dotcms.pushpublish.Activator + * + + + + + + diff --git a/com.dotcms.rest/README.md b/com.dotcms.rest/README.md index 826053d4..1e7e428a 100644 --- a/com.dotcms.rest/README.md +++ b/com.dotcms.rest/README.md @@ -5,7 +5,7 @@ This is an example of how to create and load Jersey Based REST resources in dotC ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.rest/build.gradle b/com.dotcms.rest/build.gradle deleted file mode 100644 index 3f6753d3..00000000 --- a/com.dotcms.rest/build.gradle +++ /dev/null @@ -1,102 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - Rest Endpoint example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotcms.plugin.rest.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "Rest Endpoint fragment" - bundleDescription = "dotCMS - Rest Endpoint fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.rest/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.rest/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.rest/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.rest/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.rest/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.rest/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.rest/gradlew b/com.dotcms.rest/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.rest/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.rest/gradlew.bat b/com.dotcms.rest/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.rest/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.rest/pom.xml b/com.dotcms.rest/pom.xml new file mode 100644 index 00000000..607f30c7 --- /dev/null +++ b/com.dotcms.rest/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + + com.dotcms + rest-endpoint-example + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - Rest Endpoint example + https://dotcms.com/ + com.dotcms.plugin.rest.Activator + * + + + + + + diff --git a/com.dotcms.ruleengine.velocityscriptingactionlet/README.md b/com.dotcms.ruleengine.velocityscriptingactionlet/README.md index 2d6ba544..968243e2 100644 --- a/com.dotcms.ruleengine.velocityscriptingactionlet/README.md +++ b/com.dotcms.ruleengine.velocityscriptingactionlet/README.md @@ -6,7 +6,7 @@ arbitrary velocity code in a rule. Using this, an admin can leverage the power ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.ruleengine.velocityscriptingactionlet/build.gradle b/com.dotcms.ruleengine.velocityscriptingactionlet/build.gradle deleted file mode 100644 index ec1de339..00000000 --- a/com.dotcms.ruleengine.velocityscriptingactionlet/build.gradle +++ /dev/null @@ -1,129 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -configurations { - provided - provided.extendsFrom(compile) -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } - - testCompile 'org.mockito:mockito-core:2.0.31-beta' - testCompile 'org.hamcrest:hamcrest-all:1.3' - testCompile('org.testng:testng:6.9.6') { - exclude(group: 'org.hamcrest') - - } -} - -/* To compile we must add the additional configuration we created to our classpaths. */ -sourceSets { - main.compileClasspath += configurations.provided - test.compileClasspath += configurations.provided - test.runtimeClasspath += configurations.provided -} - -test { - // enable TestNG support (default is JUnit) - useTestNG() - /* enabling standard streams allows us to see test failures and related stack traces in the console. */ - testLogging.showStandardStreams = true -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - Rules Engine Velocity Scripting Actionlet', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.ruleengine.actionlet.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.dependsOn test -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "Rules Engine Velocity Scripting Actionlet fragment" - bundleDescription = "dotCMS - Rules Engine Velocity Scripting Actionlet fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.ruleengine.velocityscriptingactionlet/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.ruleengine.velocityscriptingactionlet/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.ruleengine.velocityscriptingactionlet/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.ruleengine.velocityscriptingactionlet/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.ruleengine.velocityscriptingactionlet/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.ruleengine.velocityscriptingactionlet/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.ruleengine.velocityscriptingactionlet/gradlew b/com.dotcms.ruleengine.velocityscriptingactionlet/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.ruleengine.velocityscriptingactionlet/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.ruleengine.velocityscriptingactionlet/gradlew.bat b/com.dotcms.ruleengine.velocityscriptingactionlet/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.ruleengine.velocityscriptingactionlet/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.ruleengine.velocityscriptingactionlet/pom.xml b/com.dotcms.ruleengine.velocityscriptingactionlet/pom.xml new file mode 100644 index 00000000..e114eda8 --- /dev/null +++ b/com.dotcms.ruleengine.velocityscriptingactionlet/pom.xml @@ -0,0 +1,89 @@ + + 4.0.0 + + com.dotcms + rules-engine-velocity-scripting-actionlet + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + org.mockito + mockito-core + 2.0.31-beta + test + + + org.hamcrest + hamcrest-all + 1.3 + test + + + org.testng + testng + 6.9.6 + test + + + org.hamcrest + * + + + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - Rules Engine Velocity Scripting Actionlet + https://dotcms.com/ + com.dotmarketing.osgi.ruleengine.actionlet.Activator + * + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + false + + + + + + + + diff --git a/com.dotcms.ruleengine.visitoripconditionlet/README.md b/com.dotcms.ruleengine.visitoripconditionlet/README.md index 045591b3..c8596328 100644 --- a/com.dotcms.ruleengine.visitoripconditionlet/README.md +++ b/com.dotcms.ruleengine.visitoripconditionlet/README.md @@ -8,7 +8,7 @@ If you are using tomcat to retrieve the IP's with IPv4 format. `JAVA_OPTS="$JAVA ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.ruleengine.visitoripconditionlet/build.gradle b/com.dotcms.ruleengine.visitoripconditionlet/build.gradle deleted file mode 100644 index 92643e31..00000000 --- a/com.dotcms.ruleengine.visitoripconditionlet/build.gradle +++ /dev/null @@ -1,129 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -configurations { - provided - provided.extendsFrom(compile) -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } - - testCompile 'org.mockito:mockito-core:2.0.31-beta' - testCompile 'org.hamcrest:hamcrest-all:1.3' - testCompile('org.testng:testng:6.9.6') { - exclude(group: 'org.hamcrest') - - } -} - -/* To compile we must add the additional configuration we created to our classpaths. */ -sourceSets { - main.compileClasspath += configurations.provided - test.compileClasspath += configurations.provided - test.runtimeClasspath += configurations.provided -} - -test { - // enable TestNG support (default is JUnit) - useTestNG() - /* enabling standard streams allows us to see test failures and related stack traces in the console. */ - testLogging.showStandardStreams = true -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - OSGI Visitor IP Conditionlet', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.ruleengine.conditionlet.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.dependsOn test -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "OSGI Visitor IP Conditionlet fragment" - bundleDescription = "dotCMS - OSGI Visitor IP Conditionlet fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.ruleengine.visitoripconditionlet/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.ruleengine.visitoripconditionlet/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.ruleengine.visitoripconditionlet/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.ruleengine.visitoripconditionlet/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.ruleengine.visitoripconditionlet/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.ruleengine.visitoripconditionlet/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.ruleengine.visitoripconditionlet/gradlew b/com.dotcms.ruleengine.visitoripconditionlet/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.ruleengine.visitoripconditionlet/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.ruleengine.visitoripconditionlet/gradlew.bat b/com.dotcms.ruleengine.visitoripconditionlet/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.ruleengine.visitoripconditionlet/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.ruleengine.visitoripconditionlet/pom.xml b/com.dotcms.ruleengine.visitoripconditionlet/pom.xml new file mode 100644 index 00000000..fc183b35 --- /dev/null +++ b/com.dotcms.ruleengine.visitoripconditionlet/pom.xml @@ -0,0 +1,89 @@ + + 4.0.0 + + com.dotcms + visitor-ip-conditionlet + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + org.mockito + mockito-core + 2.0.31-beta + test + + + org.hamcrest + hamcrest-all + 1.3 + test + + + org.testng + testng + 6.9.6 + test + + + org.hamcrest + * + + + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - OSGI Visitor IP Conditionlet + https://dotcms.com/ + com.dotmarketing.osgi.ruleengine.conditionlet.Activator + * + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + false + + + + + + + + diff --git a/com.dotcms.simpleService/README.md b/com.dotcms.simpleService/README.md index 57e89149..5fc02b8a 100644 --- a/com.dotcms.simpleService/README.md +++ b/com.dotcms.simpleService/README.md @@ -5,7 +5,7 @@ This bundle plugin is an example of how to add a simple service class that can b ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.simpleService/build.gradle b/com.dotcms.simpleService/build.gradle deleted file mode 100644 index 34845ce4..00000000 --- a/com.dotcms.simpleService/build.gradle +++ /dev/null @@ -1,103 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - A bundle that creates a custom service', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.service.Activator', - 'Export-Package': 'com.dotmarketing.osgi.service', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "Service fragment" - bundleDescription = "dotCMS - A bundle that creates a custom service fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.simpleService/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.simpleService/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.simpleService/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.simpleService/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.simpleService/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.simpleService/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.simpleService/gradlew b/com.dotcms.simpleService/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.simpleService/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.simpleService/gradlew.bat b/com.dotcms.simpleService/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.simpleService/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.simpleService/pom.xml b/com.dotcms.simpleService/pom.xml new file mode 100644 index 00000000..b83e98ae --- /dev/null +++ b/com.dotcms.simpleService/pom.xml @@ -0,0 +1,54 @@ + + 4.0.0 + + com.dotcms + custom-service-bundle + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - A bundle that creates a custom service + https://dotcms.com/ + com.dotmarketing.osgi.service.Activator + com.dotmarketing.osgi.service + * + + + + + + diff --git a/com.dotcms.staticpublish.listener/README.md b/com.dotcms.staticpublish.listener/README.md index cf327748..cc28b6c0 100644 --- a/com.dotcms.staticpublish.listener/README.md +++ b/com.dotcms.staticpublish.listener/README.md @@ -12,7 +12,7 @@ For further information about dotCMS Dynamic Plugins and Push Publishing Listene ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.staticpublish.listener/build.gradle b/com.dotcms.staticpublish.listener/build.gradle deleted file mode 100644 index 20368cec..00000000 --- a/com.dotcms.staticpublish.listener/build.gradle +++ /dev/null @@ -1,133 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -configurations { - pluginLibs -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } - - compileOnly('com.hierynomus:sshj:0.35.0'){ - exclude group: 'org.bouncycastle' //Why we exlude? See README's important notes. - } - compileOnly('org.slf4j:slf4j-simple:1.7.7') -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - OSGI Static Event Listener example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotcms.staticpublish.Activator', - 'Bundle-ClassPath': ''' - ., - libs/eddsa-0.2.0.jar, - libs/jzlib-1.1.3.jar, - libs/slf4j-api-1.7.7.jar, - libs/slf4j-simple-1.7.7.jar, - libs/sshj-0.35.0.jar - ''', - 'Export-Package':''' - org.bouncycastle.jce.provider.*, - org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi.*, - org.bouncycastle.jcajce.provider.digest.*, - org.bouncycastle.jcajce.provider.asymmetric.ec.KeyAgreementSpi.*, - org.bouncycastle.jcajce.provider.asymmetric.* - ''', - 'Import-Package': '*;version=0' - ) - } -} - -task copyToLib(type: Copy) { - into "src/main/resources/libs" - from configurations.compileOnly -} - -jar.dependsOn copyToLib -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "OSGI Static Event Listener fragment" - bundleDescription = "dotCMS - OSGI Static Event Listener fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.staticpublish.listener/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.staticpublish.listener/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.staticpublish.listener/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.staticpublish.listener/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.staticpublish.listener/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.staticpublish.listener/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.staticpublish.listener/gradlew b/com.dotcms.staticpublish.listener/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.staticpublish.listener/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.staticpublish.listener/gradlew.bat b/com.dotcms.staticpublish.listener/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.staticpublish.listener/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.staticpublish.listener/pom.xml b/com.dotcms.staticpublish.listener/pom.xml new file mode 100644 index 00000000..2dc529cf --- /dev/null +++ b/com.dotcms.staticpublish.listener/pom.xml @@ -0,0 +1,79 @@ + + 4.0.0 + + com.dotcms + osgi-static-event-listener + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + com.hierynomus + sshj + 0.23.0 + provided + + + org.slf4j + slf4j-simple + 1.7.7 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - OSGI Static Event Listener example + https://dotcms.com/ + com.dotcms.staticpublish.Activator + ., + libs/eddsa-0.2.0.jar, + libs/jzlib-1.1.3.jar, + libs/slf4j-api-1.7.7.jar, + libs/slf4j-simple-1.7.7.jar, + libs/sshj-0.23.0.jar + + + org.bouncycastle.jce.provider.*, + org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi.*, + org.bouncycastle.jcajce.provider.digest.*, + org.bouncycastle.jcajce.provider.asymmetric.ec.KeyAgreementSpi.*, + org.bouncycastle.jcajce.provider.asymmetric.* + + * + + + + + + diff --git a/com.dotcms.tuckey/README.md b/com.dotcms.tuckey/README.md index 95117999..06e234d0 100644 --- a/com.dotcms.tuckey/README.md +++ b/com.dotcms.tuckey/README.md @@ -6,7 +6,7 @@ This bundle plugin is an example of how add Tuckey rewrite Rules using an OSGI b ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.tuckey/build.gradle b/com.dotcms.tuckey/build.gradle deleted file mode 100644 index 3b1b1839..00000000 --- a/com.dotcms.tuckey/build.gradle +++ /dev/null @@ -1,102 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - Tuckey Rewrite Rules example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotcms.tuckey.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "Tuckey Rewrite Rules fragment" - bundleDescription = "dotCMS - Tuckey Rewrite Rules fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.tuckey/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.tuckey/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.tuckey/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.tuckey/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.tuckey/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.tuckey/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.tuckey/gradlew b/com.dotcms.tuckey/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.tuckey/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.tuckey/gradlew.bat b/com.dotcms.tuckey/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.tuckey/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.tuckey/pom.xml b/com.dotcms.tuckey/pom.xml new file mode 100644 index 00000000..1f049cf2 --- /dev/null +++ b/com.dotcms.tuckey/pom.xml @@ -0,0 +1,56 @@ + + 4.0.0 + + com.dotcms + tuckey + 0.3 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + + + com.dotcms + dotcms-core + 24.05.13 + compile + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + ${project.group} + dotCMS - Tuckey Rewrite Rules example + https://dotcms.com/ + com.dotcms.tuckey.Activator + * + + + + + + + diff --git a/com.dotcms.viewtool/README.md b/com.dotcms.viewtool/README.md index f67337b6..f832390f 100644 --- a/com.dotcms.viewtool/README.md +++ b/com.dotcms.viewtool/README.md @@ -3,7 +3,7 @@ ## How to build this example To install all you need to do is build the JAR. to do this run -`./gradlew jar` +`mvn clean install` This will build two jars in the `build/libs` directory: a bundle fragment (in order to expose needed 3rd party libraries from dotCMS) and the plugin jar diff --git a/com.dotcms.viewtool/build.gradle b/com.dotcms.viewtool/build.gradle deleted file mode 100644 index 2c4ac606..00000000 --- a/com.dotcms.viewtool/build.gradle +++ /dev/null @@ -1,102 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - Osgi View Tool example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.viewtools.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "Osgi View Tool fragment" - bundleDescription = "dotCMS - Osgi View Tool fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.viewtool/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.viewtool/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.viewtool/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.viewtool/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.viewtool/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.viewtool/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.viewtool/gradlew b/com.dotcms.viewtool/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.viewtool/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.viewtool/gradlew.bat b/com.dotcms.viewtool/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.viewtool/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.viewtool/pom.xml b/com.dotcms.viewtool/pom.xml new file mode 100644 index 00000000..3330d229 --- /dev/null +++ b/com.dotcms.viewtool/pom.xml @@ -0,0 +1,75 @@ + + 4.0.0 + + com.dotcms + viewtool + 0.3 + bundle + + + UTF-8 + 11 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + + + org.osgi + org.osgi.core + 6.0.0 + provided + + + org.apache.logging.log4j + log4j-api + 2.13.3 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - Osgi View Tool example + JavaSE-11 + com.dotcms.viewtool + 0.3 + dotCMS - Osgi View Tool example + https://dotcms.com/ + com.dotmarketing.osgi.viewtools.Activator + * + + + + + + \ No newline at end of file diff --git a/com.dotcms.viewtool/src/main/java/com/dotmarketing/osgi/viewtools/Activator.java b/com.dotcms.viewtool/src/main/java/com/dotmarketing/osgi/viewtools/Activator.java index 8511f758..93283737 100644 --- a/com.dotcms.viewtool/src/main/java/com/dotmarketing/osgi/viewtools/Activator.java +++ b/com.dotcms.viewtool/src/main/java/com/dotmarketing/osgi/viewtools/Activator.java @@ -2,15 +2,21 @@ import org.osgi.framework.BundleContext; import com.dotmarketing.osgi.GenericBundleActivator; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + public class Activator extends GenericBundleActivator { + private Logger logger = LogManager.getLogger(Activator.class); + + @Override public void start ( BundleContext bundleContext ) throws Exception { //Initializing services... initializeServices( bundleContext ); - + logger.info("Registering the ViewTool service"); //Registering the ViewTool service registerViewToolService( bundleContext, new MyToolInfo() ); } diff --git a/com.dotcms.webinterceptor/bin/.gitignore b/com.dotcms.webinterceptor/bin/.gitignore deleted file mode 100644 index ddf9c656..00000000 --- a/com.dotcms.webinterceptor/bin/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/main/ diff --git a/com.dotcms.webinterceptor/build.gradle b/com.dotcms.webinterceptor/build.gradle deleted file mode 100644 index 0503be61..00000000 --- a/com.dotcms.webinterceptor/build.gradle +++ /dev/null @@ -1,102 +0,0 @@ -plugins { - id 'biz.aQute.bnd.builder' version '3.3.0' -} - -sourceCompatibility = '1.8' -version = '0.2' - -repositories { - maven { url "http://repo.dotcms.com/artifactory/libs-release" } -} - -dependencies { - compile('com.dotcms:dotcms:23.06') { transitive = true } -} - -import java.util.jar.* - -///////////////////////// -//Plugin jar -///////////////////////// -jar { - manifest { - attributes ( - 'Bundle-Vendor': 'dotCMS', - 'Bundle-Description': 'dotCMS - Osgi Web Interceptors example', - 'Bundle-DocURL': 'https://dotcms.com/', - 'Bundle-Activator': 'com.dotmarketing.osgi.webinterceptors.Activator', - 'Import-Package': '*;version=0' - ) - } -} -jar.finalizedBy 'fragmentJar' - -///////////////////////// -//Fragment jar -///////////////////////// - -ext { - bundleName = "Web Interceptors example fragment" - bundleDescription = "dotCMS - Web Interceptors example fragment" - fragmentHost = "system.bundle; extension:=framework" - bundleSymbolicName = "" //Auto generated based on the plugin jar - bundleVersion = "" //Auto generated based on the plugin jar - importPackage = "" //Auto generated based on the plugin jar - bundleManifestVersion = "" //Auto generated based on the plugin jar - bundleDocURL = "" //Auto generated based on the plugin jar - bundleVendor = "" //Auto generated based on the plugin jar -} -/** - * The import generates versions like this: version="[1.8,2)" - * That format does not work for the export, so we need to replace it - * to: version=0 - */ -ext.fixVersionNumber = {importValue -> - return importValue.replaceAll("\"\\[[0-9.,]+\\)\"", "0") -} - -/** - * Reads the Manifest file of the just created plugin jar in order to get the required info - * to automatically create the fragment jar. - */ -task readManifesttAttributes { - doFirst { - File file = configurations.baseline.singleFile - JarFile jar = new JarFile(file) - Attributes manifest = jar.getManifest().getMainAttributes() - bundleSymbolicName = "${manifest.getValue('Bundle-SymbolicName')}" - bundleVersion = "${manifest.getValue('Bundle-Version')}" - importPackage = "${manifest.getValue('Import-Package')}" - bundleManifestVersion = "${manifest.getValue('Bundle-ManifestVersion')}" - bundleDocURL = "${manifest.getValue('Bundle-DocURL')}" - bundleVendor = "${manifest.getValue('Bundle-Vendor')}" - } -} -task fragmentJar(type: Jar) { - - doFirst { - //Setting the fragment jar name - baseName = project.name - archiveName = "${baseName}.fragment-${version}.jar" - importPackage = fixVersionNumber(importPackage) - - manifest { - attributes ( - 'Bundle-Name': "${bundleName}", - 'Bundle-Description': "${bundleDescription}", - 'Bundle-Vendor': "${bundleVendor}", - 'Bundle-Version': "${version}", - 'Bundle-SymbolicName': "${baseName}.fragment", - 'Bundle-ManifestVersion': "${bundleManifestVersion}", - 'Bundle-DocURL': "${bundleDocURL}", - 'Fragment-Host': "${fragmentHost}", - 'Export-Package': "${importPackage}" - ) - } - } -} -fragmentJar.dependsOn 'readManifesttAttributes' - -task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' -} diff --git a/com.dotcms.webinterceptor/gradle/wrapper/gradle-wrapper.jar b/com.dotcms.webinterceptor/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 29953ea1..00000000 Binary files a/com.dotcms.webinterceptor/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.dotcms.webinterceptor/gradle/wrapper/gradle-wrapper.properties b/com.dotcms.webinterceptor/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e0b3fb8d..00000000 --- a/com.dotcms.webinterceptor/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/com.dotcms.webinterceptor/gradlew b/com.dotcms.webinterceptor/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/com.dotcms.webinterceptor/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.dotcms.webinterceptor/gradlew.bat b/com.dotcms.webinterceptor/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/com.dotcms.webinterceptor/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.dotcms.webinterceptor/pom.xml b/com.dotcms.webinterceptor/pom.xml new file mode 100644 index 00000000..b855b398 --- /dev/null +++ b/com.dotcms.webinterceptor/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.dotcms + osgi-web-interceptors-example + 0.2 + bundle + + + UTF-8 + 11 + 11 + + + + + dotcms-repo + https://artifactory.dotcms.cloud/artifactory/libs-release + + + + + + com.dotcms + dotcms-core + 24.05.13 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + dotCMS + dotCMS - Osgi Web Interceptors example + https://dotcms.com/ + com.dotmarketing.osgi.webinterceptors.Activator + * + + + + + + + + diff --git a/com.dotcms.webinterceptor/src/main/java/com/dotmarketing/osgi/webinterceptors/WrappingWebInterceptor.java b/com.dotcms.webinterceptor/src/main/java/com/dotmarketing/osgi/webinterceptors/WrappingWebInterceptor.java index 31283495..c61a9f26 100644 --- a/com.dotcms.webinterceptor/src/main/java/com/dotmarketing/osgi/webinterceptors/WrappingWebInterceptor.java +++ b/com.dotcms.webinterceptor/src/main/java/com/dotmarketing/osgi/webinterceptors/WrappingWebInterceptor.java @@ -1,6 +1,5 @@ package com.dotmarketing.osgi.webinterceptors; -import static com.dotcms.util.CollectionsUtils.map; import java.io.IOException; import java.util.Map; import javax.servlet.http.HttpServletRequest; @@ -46,7 +45,7 @@ public Result intercept(final HttpServletRequest request, final HttpServletRespo // just includes some dummy attributes by default private class PreloadRequest extends HttpServletRequestWrapper { - private Map attributes = map("hello", "This is a hello test", + private Map attributes = Map.of("hello", "This is a hello test", "pi", new Double(3.14159265359), "goldenratio", new Double(1.6180339887)) ;