refactoring
This commit is contained in:
Binary file not shown.
8
bin/deploy
Executable file
8
bin/deploy
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# deploy the server
|
||||||
|
#
|
||||||
|
# usage:
|
||||||
|
# deploy server/target/ejb-uebung-1.0-SNAPSHOT.jar
|
||||||
|
|
||||||
|
cp -v "$1" "$WILDFLY_BASE_DIR/deployments/"
|
||||||
6
bin/run
Executable file
6
bin/run
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# usage
|
||||||
|
# run org.example.demo.uebung1.aufgabe16.Client
|
||||||
|
|
||||||
|
(cd client && mvn clean compile && mvn exec:java -Dexec.mainClass="$1")
|
||||||
8
bin/start
Executable file
8
bin/start
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# starts the server
|
||||||
|
#
|
||||||
|
# usage:
|
||||||
|
# start
|
||||||
|
|
||||||
|
wildfly-fhs
|
||||||
37
client/pom.xml
Normal file
37
client/pom.xml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>de.componentware</groupId>
|
||||||
|
<artifactId>componentware-parent</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<artifactId>ejb-client</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<dependencies>
|
||||||
|
<!-- Abhängigkeit zu den EJB-Interfaces des Server-Moduls -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.componentware</groupId>
|
||||||
|
<artifactId>ejb-uebung</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- BOM für alle WildFly EJB-Client Abhängigkeiten -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wildfly</groupId>
|
||||||
|
<artifactId>wildfly-ejb-client-bom</artifactId>
|
||||||
|
<version>39.0.0.Final</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.11.0</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -11,8 +11,8 @@ public class Client {
|
|||||||
props.setProperty(Context.PROVIDER_URL, "http-remoting://localhost:8080");
|
props.setProperty(Context.PROVIDER_URL, "http-remoting://localhost:8080");
|
||||||
|
|
||||||
InitialContext ctx = new InitialContext(props);
|
InitialContext ctx = new InitialContext(props);
|
||||||
EncryptorRemote encryptor = (EncryptorRemote) ctx.lookup(
|
String jndiName = "ejb:/ejb-uebung-1.0-SNAPSHOT/Encryptor!org.example.demo.uebung1.aufgabe16.EncryptorRemote";
|
||||||
"ejb:/demo/Encryptor!encryption.EncryptorRemote");
|
EncryptorRemote encryptor = (EncryptorRemote) ctx.lookup(jndiName);
|
||||||
|
|
||||||
String original = "Hallo Welt";
|
String original = "Hallo Welt";
|
||||||
String encrypted = encryptor.encrypt(original);
|
String encrypted = encryptor.encrypt(original);
|
||||||
@@ -3,7 +3,7 @@ import javax.naming.InitialContext;
|
|||||||
import javax.naming.Context;
|
import javax.naming.Context;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
public class CounterClient {
|
public class Client {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
|
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
|
||||||
@@ -11,8 +11,8 @@ public class CounterClient {
|
|||||||
props.setProperty(Context.PROVIDER_URL, "http-remoting://localhost:8080");
|
props.setProperty(Context.PROVIDER_URL, "http-remoting://localhost:8080");
|
||||||
|
|
||||||
InitialContext ctx = new InitialContext(props);
|
InitialContext ctx = new InitialContext(props);
|
||||||
CounterRemote counter = (CounterRemote) ctx.lookup(
|
String jndiName = "ejb:/ejb-uebung-1.0-SNAPSHOT/Counter!org.example.demo.uebung1.aufgabe17.CounterRemote?stateful";
|
||||||
"ejb:/demo/Counter!counter.CounterRemote?stateful");
|
CounterRemote counter = (CounterRemote) ctx.lookup(jndiName);
|
||||||
|
|
||||||
System.out.println(counter.getAndIncrement());
|
System.out.println(counter.getAndIncrement());
|
||||||
System.out.println(counter.getAndIncrement());
|
System.out.println(counter.getAndIncrement());
|
||||||
17
flake.nix
17
flake.nix
@@ -129,7 +129,7 @@
|
|||||||
|
|
||||||
devShells.default = with pkgs;
|
devShells.default = with pkgs;
|
||||||
mkShell {
|
mkShell {
|
||||||
buildInputs = [wildfly-fhs pkgs.openjdk21];
|
buildInputs = [wildfly-fhs pkgs.openjdk21 maven];
|
||||||
nativeBuildInputs = [];
|
nativeBuildInputs = [];
|
||||||
packages =
|
packages =
|
||||||
[
|
[
|
||||||
@@ -143,21 +143,8 @@
|
|||||||
shellHook =
|
shellHook =
|
||||||
# bash
|
# bash
|
||||||
''
|
''
|
||||||
|
export PATH="bin/:$PATH"
|
||||||
export WILDFLY_BASE_DIR="$HOME/.wildfly-fhs-base"
|
export WILDFLY_BASE_DIR="$HOME/.wildfly-fhs-base"
|
||||||
|
|
||||||
build() {
|
|
||||||
# builds target/demo.war
|
|
||||||
mvn clean package
|
|
||||||
}
|
|
||||||
|
|
||||||
# e.g. 'deploy target/demo.war'
|
|
||||||
deploy() {
|
|
||||||
cp -v "$1" "$WILDFLY_BASE_DIR/deployments/"
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
wildfly-fhs
|
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
81
pom.xml
Executable file → Normal file
81
pom.xml
Executable file → Normal file
@@ -1,76 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.example</groupId>
|
<groupId>de.componentware</groupId>
|
||||||
<artifactId>demo</artifactId>
|
<artifactId>componentware-parent</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<name>demo</name>
|
<packaging>pom</packaging>
|
||||||
<packaging>war</packaging>
|
<modules>
|
||||||
|
<module>server</module>
|
||||||
|
<module>client</module>
|
||||||
|
</modules>
|
||||||
<properties>
|
<properties>
|
||||||
|
<maven.compiler.source>21</maven.compiler.source>
|
||||||
|
<maven.compiler.target>21</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.report.sourceEncoding>UTF-8</project.report.sourceEncoding>
|
|
||||||
<maven.compiler.release>21</maven.compiler.release>
|
|
||||||
<junit.version>5.11.0-M2</junit.version>
|
|
||||||
<compiler-plugin.version>3.13.0</compiler-plugin.version>
|
|
||||||
<war-plugin.version>3.4.0</war-plugin.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>jakarta.platform</groupId>
|
|
||||||
<artifactId>jakarta.jakartaee-web-api</artifactId>
|
|
||||||
<version>11.0.0</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.glassfish</groupId>
|
|
||||||
<artifactId>jakarta.faces</artifactId>
|
|
||||||
<version>4.1.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>jakarta.enterprise</groupId>
|
|
||||||
<artifactId>jakarta.enterprise.cdi-api</artifactId>
|
|
||||||
<version>4.1.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>jakarta.enterprise</groupId>
|
|
||||||
<artifactId>jakarta.enterprise.cdi-el-api</artifactId>
|
|
||||||
<version>4.1.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jboss.weld.servlet</groupId>
|
|
||||||
<artifactId>weld-servlet-core</artifactId>
|
|
||||||
<version>5.1.2.Final</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
|
||||||
<version>${junit.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>1.18.30</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.primefaces</groupId>
|
|
||||||
<artifactId>primefaces</artifactId>
|
|
||||||
<version>15.0.3</version>
|
|
||||||
<classifier>jakarta</classifier>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<build>
|
|
||||||
<finalName>demo</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>${compiler-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
|
||||||
<version>${war-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
33
server/pom.xml
Executable file
33
server/pom.xml
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>de.componentware</groupId>
|
||||||
|
<artifactId>componentware-parent</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<artifactId>ejb-uebung</artifactId>
|
||||||
|
<packaging>ejb</packaging>
|
||||||
|
<dependencies>
|
||||||
|
<!-- Jakarta EE 10 API (wird von WildFly bereitgestellt) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>10.0.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-ejb-plugin</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
<configuration>
|
||||||
|
<ejbVersion>4.0</ejbVersion>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
Reference in New Issue
Block a user