initial commit
This commit is contained in:
commit
96f1fd7619
50
.gitignore
vendored
Normal file
50
.gitignore
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# Compiled source #
|
||||||
|
###################
|
||||||
|
*.com
|
||||||
|
*.class
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
*.o
|
||||||
|
*.so
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
~*
|
||||||
|
*.idea
|
||||||
|
*.iml
|
||||||
|
MANIFEST.MF
|
||||||
|
|
||||||
|
# Packages #
|
||||||
|
############
|
||||||
|
# it's better to unpack these files and commit the raw source
|
||||||
|
# git has its own built in compression methods
|
||||||
|
*.7z
|
||||||
|
*.dmg
|
||||||
|
*.gz
|
||||||
|
*.iso
|
||||||
|
*.jar
|
||||||
|
*.rar
|
||||||
|
*.tar
|
||||||
|
*.zip
|
||||||
|
|
||||||
|
# Logs and databases #
|
||||||
|
######################
|
||||||
|
*.log
|
||||||
|
*.sqlite
|
||||||
|
|
||||||
|
# OS generated files #
|
||||||
|
######################
|
||||||
|
.DS_Store
|
||||||
|
.DS_Store?
|
||||||
|
._*
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
ehthumbs.db
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Directory #
|
||||||
|
#############
|
||||||
|
bin/
|
||||||
|
out/
|
||||||
|
target/
|
||||||
|
.vscode/launch.json
|
67
module-ear/pom.xml
Normal file
67
module-ear/pom.xml
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>app</artifactId>
|
||||||
|
<groupId>pl.myboardgames</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>module-ear</artifactId>
|
||||||
|
<packaging>ear</packaging>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>pl.myboardgames</groupId>
|
||||||
|
<artifactId>module-web</artifactId>
|
||||||
|
<type>war</type>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>pl.myboardgames</groupId>
|
||||||
|
<artifactId>module-ejb</artifactId>
|
||||||
|
<type>ejb</type>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.wildfly.plugins</groupId>
|
||||||
|
<artifactId>wildfly-maven-plugin</artifactId>
|
||||||
|
<version>2.0.0.Final</version>
|
||||||
|
<configuration>
|
||||||
|
<hostname>127.0.0.1</hostname>
|
||||||
|
<port>9990</port>
|
||||||
|
<username>admin</username>
|
||||||
|
<password>admin</password>
|
||||||
|
<name>myboardgames.ear</name>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<!-- Undeploy the application on clean -->
|
||||||
|
<execution>
|
||||||
|
<id>undeploy</id>
|
||||||
|
<phase>clean</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>undeploy</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<ignoreMissingDeployment>true</ignoreMissingDeployment>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
|
||||||
|
<!-- Deploy the application on install -->
|
||||||
|
<execution>
|
||||||
|
<id>deploy</id>
|
||||||
|
<phase>install</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>deploy</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
21
module-ejb/pom.xml
Normal file
21
module-ejb/pom.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>app</artifactId>
|
||||||
|
<groupId>pl.myboardgames</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>module-ejb</artifactId>
|
||||||
|
<packaging>ejb</packaging>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax</groupId>
|
||||||
|
<artifactId>javaee-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
12
module-ejb/src/main/java/pl/myboardgames/ExampleService.java
Normal file
12
module-ejb/src/main/java/pl/myboardgames/ExampleService.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package pl.myboardgames;
|
||||||
|
|
||||||
|
import javax.ejb.Stateless;
|
||||||
|
|
||||||
|
@Stateless
|
||||||
|
public class ExampleService {
|
||||||
|
|
||||||
|
public String whoAmI() {
|
||||||
|
return "i'm ExampleService";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
18
module-web/nb-configuration.xml
Normal file
18
module-web/nb-configuration.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
28
module-web/pom.xml
Normal file
28
module-web/pom.xml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>app</artifactId>
|
||||||
|
<groupId>pl.myboardgames</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>module-web</artifactId>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>module-web</name>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>pl.myboardgames</groupId>
|
||||||
|
<artifactId>module-ejb</artifactId>
|
||||||
|
<type>ejb</type>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax</groupId>
|
||||||
|
<artifactId>javaee-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -0,0 +1,32 @@
|
|||||||
|
package pl.myboardgames;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
@Path("/board")
|
||||||
|
@RequestScoped
|
||||||
|
public class BoardGameController {
|
||||||
|
|
||||||
|
// @EJB
|
||||||
|
// ExampleService exampleService;
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Produces("application/json; charset=UTF-8")
|
||||||
|
public Response getAllBoardGames() {
|
||||||
|
|
||||||
|
BoardGameEntity board1 = new BoardGameEntity("Dominion");
|
||||||
|
BoardGameEntity board2 = new BoardGameEntity("Agricola");
|
||||||
|
|
||||||
|
List<BoardGameEntity> ret = new ArrayList<>();
|
||||||
|
|
||||||
|
ret.add(board1);
|
||||||
|
ret.add(board2);
|
||||||
|
|
||||||
|
return Response.status(200).entity(ret).build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package pl.myboardgames;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BoardGameEntity {
|
||||||
|
private String name;
|
||||||
|
private Integer minPlayers;
|
||||||
|
private Integer maxPlayers;
|
||||||
|
private Integer playTime;
|
||||||
|
private String location;
|
||||||
|
private List<String> categories;
|
||||||
|
|
||||||
|
public BoardGameEntity(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMinPlayers() {
|
||||||
|
return minPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMaxPlayers() {
|
||||||
|
return maxPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPlayTime() {
|
||||||
|
return playTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List getCategories() {
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinPlayers(Integer minPlayers) {
|
||||||
|
this.minPlayers = minPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxPlayers(Integer maxPlayers) {
|
||||||
|
this.maxPlayers = maxPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayTime(Integer playTime) {
|
||||||
|
this.playTime = playTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocation(String location) {
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
18
module-web/src/main/java/pl/myboardgames/JaxRsActivator.java
Normal file
18
module-web/src/main/java/pl/myboardgames/JaxRsActivator.java
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package pl.myboardgames;
|
||||||
|
|
||||||
|
import javax.ws.rs.ApplicationPath;
|
||||||
|
import javax.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6
|
||||||
|
* "no XML" approach to activating JAX-RS.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Resources are served relative to the servlet path specified in the {@link ApplicationPath}
|
||||||
|
* annotation.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@ApplicationPath("/api/v1")
|
||||||
|
public class JaxRsActivator extends Application {
|
||||||
|
/* class body intentionally left blank */
|
||||||
|
}
|
14
module-web/src/main/java/pl/myboardgames/UserEntity.java
Normal file
14
module-web/src/main/java/pl/myboardgames/UserEntity.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package pl.myboardgames;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class UserEntity {
|
||||||
|
private String name;
|
||||||
|
private List<BoardGameEntity> boardgames;
|
||||||
|
|
||||||
|
public void addBoard(BoardGameEntity board) {
|
||||||
|
this.boardgames.add(board);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
94
pom.xml
Normal file
94
pom.xml
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>pl.myboardgames</groupId>
|
||||||
|
<artifactId>app</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>module-ejb</module>
|
||||||
|
<module>module-web</module>
|
||||||
|
<module>module-ear</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>pl.myboardgames</groupId>
|
||||||
|
<artifactId>module-ejb</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<type>ejb</type>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>pl.myboardgames</groupId>
|
||||||
|
<artifactId>module-web</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<type>war</type>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax</groupId>
|
||||||
|
<artifactId>javaee-api</artifactId>
|
||||||
|
<version>7.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.3</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-ejb-plugin</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
<configuration>
|
||||||
|
<ejbVersion>3.1</ejbVersion>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.2.2</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-ear-plugin</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
<configuration>
|
||||||
|
<version>7</version>
|
||||||
|
<!--<modules>-->
|
||||||
|
<!--<webModule>-->
|
||||||
|
<!--<groupId>pl.myboardgames</groupId>-->
|
||||||
|
<!--<artifactId>module-web</artifactId>-->
|
||||||
|
<!--<contextRoot>/</contextRoot>-->
|
||||||
|
<!--</webModule>-->
|
||||||
|
<!--</modules>-->
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
<name>app</name>
|
||||||
|
</project>
|
Loading…
Reference in New Issue
Block a user