-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
10 changed files
with
145 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
:toc: | ||
toc::[] | ||
|
||
= Tomcat | ||
|
||
The `Tomcat` commandlet allows to install install, configure, and launch https://tomcat.apache.org/[tomcat]. | ||
|
||
The arguments (`devon tomcat «args»`) are explained by the following table: | ||
|
||
.Usage of `devon tomcat` | ||
[options="header"] | ||
|======================= | ||
|*Argument(s)* |*Meaning* | ||
|`setup` |setup Tomcat (install or update and verify), via `TOMCAT_VERSION` (use `devon tomcat version list` to get available versions or `devon tomcat version set [TAB]` to set version with auto-completion) | ||
|`start` |start Tomcat | ||
|`stop` |stop Tomcat | ||
|======================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env bash | ||
|
||
# autocompletion list | ||
if [ "${1}" = "shortlist" ] | ||
then | ||
if [ -z "${2}" ] | ||
then | ||
echo "setup start stop version help" | ||
fi | ||
exit | ||
fi | ||
|
||
|
||
|
||
# shellcheck source=scripts/functions | ||
source "$(dirname "${0}")"/../functions | ||
export CATALINA_HOME="${DEVON_IDE_HOME}/software/tomcat" | ||
TOMCAT_HOME="${DEVON_IDE_HOME}/software/tomcat" | ||
TOMCAT="${TOMCAT_HOME}/bin/catalina.sh" | ||
|
||
TOOL_VERSION_COMMAND="${TOMCAT} version" | ||
# shellcheck source=scripts/commandlet-cli | ||
source "$(dirname "${0}")"/../commandlet-cli | ||
|
||
# $1: optional silent mode | ||
function doSetup() { | ||
doDevonCommand java setup silent | ||
doInstall "tomcat" "${TOMCAT_VERSION}" "${1}" | ||
return 0 | ||
} | ||
|
||
function doStart() { | ||
# dosetup silent | ||
# doRunCommand "${TOMCAT_HOME}/bin/startup.bat"# | ||
doTomcat start | ||
} | ||
|
||
function doStop() { | ||
doTomcat stop | ||
} | ||
|
||
function doTomcat() { | ||
doSetup silent | ||
|
||
if [ "${1}" = "start" ] | ||
then | ||
"${TOMCAT_HOME}/bin/startup.sh" | ||
elif [ "${1}" = "stop" ] | ||
then | ||
"${TOMCAT_HOME}/bin/shutdown.sh" | ||
else | ||
doFail "Unknown tomcat command: ${1}" | ||
fi | ||
|
||
if [ "${1}" = "start" ] | ||
then | ||
echo "Tomcat is running at localhost on the following port (default 8080):" | ||
grep 'Connector port=' "${TOMCAT_HOME}/conf/server.xml" | awk -F'"' '{print $2}'| head -1 | ||
fi | ||
} | ||
|
||
# CLI | ||
if [ "${1}" = "-h" ] || [ "${1}" = "help" ] | ||
then | ||
echo "Setup or run Tomcat on local machine." | ||
echo | ||
echo "Arguments:" | ||
echo " start start tomcat on your machine" | ||
echo " stop stop tomcat on your machine" | ||
echo " setup install tomcat on your machine (install, verify)" | ||
elif [ "${1}" = "setup" ] | ||
then | ||
doSetup "${2}" | ||
elif [ "${1}" = "start" ] | ||
then | ||
doStart | ||
elif [ "${1}" = "stop" ] | ||
then | ||
doStop | ||
else | ||
doFail "undefined argument ${*}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
url-updater/src/main/java/com/devonfw/tools/ide/url/updater/tomcat/TomcatUrlUpdater.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.devonfw.tools.ide.url.updater.tomcat; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
import com.devonfw.tools.ide.common.OperatingSystem; | ||
import com.devonfw.tools.ide.url.model.folder.UrlVersion; | ||
import com.devonfw.tools.ide.url.updater.GithubUrlUpdater; | ||
|
||
/** | ||
* {@link GithubUrlUpdater} for Tomcat. | ||
*/ | ||
public class TomcatUrlUpdater extends GithubUrlUpdater { | ||
|
||
@Override | ||
protected String getTool() { | ||
|
||
return "tomcat"; | ||
} | ||
|
||
@Override | ||
protected void addVersion(UrlVersion urlVersion) { | ||
doAddVersion(urlVersion, "https://archive.apache.org/dist/tomcat/tomcat-${major}/v${version}/bin/apache-tomcat-${version}.zip"); | ||
} | ||
|
||
@Override | ||
protected String getGithubOrganization() { | ||
|
||
return "apache"; | ||
} | ||
|
||
@Override | ||
protected String getGithubRepository() { | ||
|
||
return "tomcat"; | ||
} | ||
} |