Skip to content

Commit 388e111

Browse files
authored
Merge pull request #2 from temporalio/ex1
Exercise 1 for Codec Server Course in Java
2 parents ed476ef + 69a1698 commit 388e111

28 files changed

+2500
-2
lines changed

Diff for: .bash.cfg

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Avoid the 'bash: __vsc_prompt_cmd_original: command not found' error
2+
unset PROMPT_COMMAND
3+
4+
# Define some handy aliases for use in GitPod
5+
alias workspace="cd ${GITPOD_REPO_ROOT}"
6+
alias webui="gp preview $(gp url 8080)"
7+
8+
# Configure a shorter, but still useful, shell prompt
9+
export PROMPT_DIRTRIM=2
10+
export PS1="\[\033[01;34m\]\w\[\033[00m\]\$ "
11+
12+
# Exercise-specific Java aliases
13+
alias ex1="cd ${GITPOD_REPO_ROOT}/exercises/custom-converter/practice"
14+
alias ex1s="cd ${GITPOD_REPO_ROOT}/exercises/custom-converter/solution"
15+
alias ex1w="mvn exec:java -Dexec.mainClass='customconverter.ConverterWorker'"
16+
alias ex1st="mvn exec:java -Dexec.mainClass='customconverter.Starter'"

Diff for: .gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.DS_Store
2+
13
# Compiled class file
24
*.class
35
**/target/*
@@ -19,7 +21,9 @@
1921
*.zip
2022
*.tar.gz
2123
*.rar
24+
*.lst
2225

26+
**target*
2327
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2428
hs_err_pid*
2529
replay_pid*

Diff for: .gitpod.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
image: temporalio/gitpod-edu:1.2
2+
tasks:
3+
# task links a bash configuration file to a location that is not
4+
# specific to this course (/etc/bash.bashrc sources it from there)
5+
- name: Shell configuration
6+
init: |
7+
ln /workspace/edu-appdatasec-java-code/.bash.cfg /workspace/.bash.cfg
8+
exit;
9+
# task starts the Temporal Service via the CLI
10+
- name: Temporal Local Development Server
11+
command: |
12+
export TEMPORAL_NOTIFY_ON_NEW_VERSION=false
13+
export TEMPORAL_CORS_ORIGINS=http://localhost:3000
14+
temporal server start-dev \
15+
--ui-port 8080 \
16+
--db-filename /workspace/.cluster-persistence.db
17+
openMode: tab-after
18+
- name: Display Web UI
19+
command: |
20+
echo "Waiting for server...."
21+
gp ports await 8080 && gp preview $(gp url 8080)
22+
exit;
23+
- name: Display Exercise Instructions
24+
command: |
25+
gp open README.md
26+
exit;
27+
- name: Worker
28+
command: |
29+
# use the original file path so that this won't depend on the
30+
# completion of the task above that links this elsewhere (the
31+
# Docker image expects it in the same location for every course,
32+
# but this .gitpod.yml file can use course-specific paths)
33+
source /workspace/edu-appdatasec-java-code/.bash.cfg
34+
clear
35+
echo "Use this terminal to start your Worker."
36+
- name: Terminal
37+
command: |
38+
source /workspace/edu-appdatasec-java-code/.bash.cfg
39+
clear
40+
echo "Use this terminal to run commands.."
41+
openMode: split-right
42+
- name: Codecserver
43+
command: |
44+
source /workspace/edu-appdatasec-java-code/.bash.cfg
45+
clear
46+
echo "Use this terminal to run your codec server.."
47+
openMode: split-right
48+
49+
ports:
50+
- name: Temporal server
51+
port: 7233
52+
onOpen: ignore
53+
- name: Temporal Web UI v2
54+
port: 8080 # temporal UI
55+
description: New (v2) Temporal Web UI
56+
onOpen: ignore
57+
visibility: private
58+
- name: Greeting Service
59+
description: Local microservice used in exercises
60+
port: 9999
61+
onOpen: ignore
62+
visibility: private
63+
64+
vscode:
65+
extensions:
66+
- golang.Go
67+
- ms-python.python
68+
- redhat.java
69+
- vscjava.vscode-java-test
70+
- vscjava.vscode-java-debug
71+
- wingrunr21.vscode-ruby

Diff for: .vscode/custom-eclipse-java-google-style.xml

+337
Large diffs are not rendered by default.

Diff for: .vscode/settings.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"editor.minimap.enabled": false,
3+
"java.format.settings.url": "https://raw.githubusercontent.com/temporalio/edu-appdatasec-java-code/main/.vscode/custom-eclipse-java-google-style.xml",
4+
"java.checkstyle.configuration": "/google_checks.xml",
5+
"[java]": {
6+
"editor.tabSize": 2
7+
},
8+
"go.alternateTools": {
9+
"go": "/home/linuxbrew/.linuxbrew/bin/go",
10+
},
11+
"markdown.styles": [
12+
"style.css"
13+
],
14+
"terminal.integrated.defaultProfile.linux": "bash",
15+
"terminal.integrated.profiles.linux": {
16+
"bash": {
17+
"path": "/usr/bin/bash",
18+
"args": [
19+
"-l"
20+
]
21+
}
22+
},
23+
"workbench.startupEditor": "none",
24+
"workbench.editorAssociations": {
25+
"README.md": "vscode.markdown.preview.editor"
26+
}
27+
}

Diff for: LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 temporal.io
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Diff for: README.md

+38-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,38 @@
1-
# edu-appdatasec-java-code
2-
Code exercises for Securing Application Data in Temporal (Java)
1+
# Code Repository for Temporal Converters (Java)
2+
3+
This repository provides code used for exercises and demonstrations
4+
included in the Java version of the
5+
[Securing Application Data](https://learn.temporal.io/courses/appdatasec)
6+
training course.
7+
8+
It's important to remember that the example code used in this course was designed
9+
to support learning a specific aspect of Temporal, not to serve as a ready-to-use
10+
template for implementing a production system.
11+
12+
## Hands-On Exercises
13+
14+
| Directory Name | Exercise |
15+
| :--------------------------- | :------------------------------------------------- |
16+
| `exercises/custom-converter` | [Exercise 1](exercises/custom-converter/README.md) |
17+
| `exercises/codec-server` | [Exercise 2](exercises/codec-server/README.md) |
18+
19+
## Reference
20+
21+
The following links provide additional information that you may find helpful as you work through this course.
22+
23+
- [General Temporal Documentation](https://docs.temporal.io/)
24+
- [Temporal Java SDK Documentation](https://www.javadoc.io/doc/io.temporal/temporal-sdk/latest/index.html)
25+
- [Java Language Documentation](https://docs.oracle.com/en/java/)
26+
- [GitPod Documentation: Troubleshooting](https://www.gitpod.io/docs/troubleshooting)
27+
28+
## Exercise Environment for this Course
29+
30+
You can launch an exercise environment for this course in GitPod by
31+
clicking the button below:
32+
33+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/temporalio/edu-appdatasec-java-code)
34+
35+
Alternatively, you can follow
36+
[these instructions](https://learn.temporal.io/getting_started/java/dev_environment/) to
37+
set up your own Temporal Cluster with Docker Compose, which you can use as an
38+
exercise environment.

0 commit comments

Comments
 (0)