Stash changes
This commit is contained in:
parent
09095200db
commit
16f7133f21
@ -1,109 +1,120 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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">
|
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>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>open-liberty</artifactId>
|
<artifactId>open-liberty</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
<!-- Plugin versions -->
|
<!-- Plugin versions -->
|
||||||
<version.liberty-maven-plugin>3.1</version.liberty-maven-plugin>
|
<version.liberty-maven-plugin>3.1</version.liberty-maven-plugin>
|
||||||
<version.maven-war-plugin>3.2.3</version.maven-war-plugin>
|
<version.maven-war-plugin>3.2.3</version.maven-war-plugin>
|
||||||
<version.maven-surefire-plugin>2.22.2</version.maven-surefire-plugin>
|
<version.maven-surefire-plugin>2.22.2</version.maven-surefire-plugin>
|
||||||
<version.maven-failsafe-plugin>2.22.2</version.maven-failsafe-plugin>
|
<version.maven-failsafe-plugin>2.22.2</version.maven-failsafe-plugin>
|
||||||
<!-- Liberty configuration -->
|
<!-- Liberty configuration -->
|
||||||
<liberty.var.default.http.port>9080</liberty.var.default.http.port>
|
<liberty.var.default.http.port>9080</liberty.var.default.http.port>
|
||||||
<liberty.var.default.https.port>9443</liberty.var.default.https.port>
|
<liberty.var.default.https.port>9443</liberty.var.default.https.port>
|
||||||
</properties>
|
<liberty.var.app.context.root>openliberty</liberty.var.app.context.root>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- Provided dependencies -->
|
<dependency>
|
||||||
<dependency>
|
<groupId>org.apache.derby</groupId>
|
||||||
<groupId>jakarta.platform</groupId>
|
<artifactId>derby</artifactId>
|
||||||
<artifactId>jakarta.jakartaee-web-api</artifactId>
|
<version>10.14.2.0</version>
|
||||||
<version>8.0.0</version>
|
</dependency>
|
||||||
<scope>provided</scope>
|
<dependency>
|
||||||
|
<groupId>com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
<version>1.4.186</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!-- Provided dependencies -->
|
||||||
<groupId>org.eclipse.microprofile</groupId>
|
<dependency>
|
||||||
<artifactId>microprofile</artifactId>
|
<groupId>jakarta.platform</groupId>
|
||||||
<version>3.0</version>
|
<artifactId>jakarta.jakartaee-web-api</artifactId>
|
||||||
<type>pom</type>
|
<version>8.0.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- For tests -->
|
<dependency>
|
||||||
<dependency>
|
<groupId>org.eclipse.microprofile</groupId>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<artifactId>microprofile</artifactId>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<version>3.0</version>
|
||||||
<version>5.5.2</version>
|
<type>pom</type>
|
||||||
<scope>test</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!-- For tests -->
|
||||||
<groupId>org.apache.cxf</groupId>
|
<dependency>
|
||||||
<artifactId>cxf-rt-rs-client</artifactId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<version>3.3.4</version>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<version>5.5.2</version>
|
||||||
</dependency>
|
<scope>test</scope>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>org.apache.cxf</groupId>
|
<dependency>
|
||||||
<artifactId>cxf-rt-rs-extension-providers</artifactId>
|
<groupId>org.apache.cxf</groupId>
|
||||||
<version>3.3.4</version>
|
<artifactId>cxf-rt-rs-client</artifactId>
|
||||||
<scope>test</scope>
|
<version>3.3.4</version>
|
||||||
</dependency>
|
<scope>test</scope>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>org.glassfish</groupId>
|
<dependency>
|
||||||
<artifactId>javax.json</artifactId>
|
<groupId>org.apache.cxf</groupId>
|
||||||
<version>1.1.4</version>
|
<artifactId>cxf-rt-rs-extension-providers</artifactId>
|
||||||
<scope>test</scope>
|
<version>3.3.4</version>
|
||||||
</dependency>
|
<scope>test</scope>
|
||||||
<!-- Support for JDK 9 and above -->
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.xml.bind</groupId>
|
<groupId>org.glassfish</groupId>
|
||||||
<artifactId>jaxb-api</artifactId>
|
<artifactId>javax.json</artifactId>
|
||||||
<version>2.3.1</version>
|
<version>1.1.4</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
<!-- Support for JDK 9 and above -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<version>2.3.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.artifactId}</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- Enable liberty-maven plugin -->
|
<!-- Enable liberty-maven plugin -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.openliberty.tools</groupId>
|
<groupId>io.openliberty.tools</groupId>
|
||||||
<artifactId>liberty-maven-plugin</artifactId>
|
<artifactId>liberty-maven-plugin</artifactId>
|
||||||
<version>${version.liberty-maven-plugin}</version>
|
<version>${version.liberty-maven-plugin}</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
<version>${version.maven-war-plugin}</version>
|
<version>${version.maven-war-plugin}</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>${version.maven-surefire-plugin}</version>
|
<version>${version.maven-surefire-plugin}</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- Plugin to run functional tests -->
|
<!-- Plugin to run functional tests -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-failsafe-plugin</artifactId>
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
<version>${version.maven-failsafe-plugin}</version>
|
<version>${version.maven-failsafe-plugin}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<systemPropertyVariables>
|
<systemPropertyVariables>
|
||||||
<http.port>${liberty.var.default.http.port}</http.port>
|
<http.port>${liberty.var.default.http.port}</http.port>
|
||||||
</systemPropertyVariables>
|
</systemPropertyVariables>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
@ -3,7 +3,7 @@ package com.baeldung.openliberty;
|
|||||||
import javax.ws.rs.ApplicationPath;
|
import javax.ws.rs.ApplicationPath;
|
||||||
import javax.ws.rs.core.Application;
|
import javax.ws.rs.core.Application;
|
||||||
|
|
||||||
@ApplicationPath("/system")
|
@ApplicationPath("/api")
|
||||||
public class SystemApplication extends Application {
|
public class ApiApplication extends Application {
|
||||||
|
|
||||||
}
|
}
|
@ -1,29 +0,0 @@
|
|||||||
package com.baeldung.openliberty;
|
|
||||||
|
|
||||||
import javax.enterprise.context.ApplicationScoped;
|
|
||||||
|
|
||||||
import java.lang.management.MemoryMXBean;
|
|
||||||
import java.lang.management.ManagementFactory;
|
|
||||||
|
|
||||||
import org.eclipse.microprofile.health.Liveness;
|
|
||||||
import org.eclipse.microprofile.health.HealthCheck;
|
|
||||||
import org.eclipse.microprofile.health.HealthCheckResponse;
|
|
||||||
|
|
||||||
@Liveness
|
|
||||||
@ApplicationScoped
|
|
||||||
public class SystemLivenessCheck implements HealthCheck {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HealthCheckResponse call() {
|
|
||||||
MemoryMXBean memBean = ManagementFactory.getMemoryMXBean();
|
|
||||||
long memUsed = memBean.getHeapMemoryUsage().getUsed();
|
|
||||||
long memMax = memBean.getHeapMemoryUsage().getMax();
|
|
||||||
|
|
||||||
return HealthCheckResponse.named(
|
|
||||||
SystemResource.class.getSimpleName() + " liveness check")
|
|
||||||
.withData("memory used", memUsed)
|
|
||||||
.withData("memory max", memMax)
|
|
||||||
.state(memUsed < memMax * 0.9).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package com.baeldung.openliberty;
|
|
||||||
|
|
||||||
import javax.enterprise.context.ApplicationScoped;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Provider;
|
|
||||||
|
|
||||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
|
||||||
import org.eclipse.microprofile.health.Readiness;
|
|
||||||
import org.eclipse.microprofile.health.HealthCheck;
|
|
||||||
import org.eclipse.microprofile.health.HealthCheckResponse;
|
|
||||||
import org.eclipse.microprofile.health.HealthCheckResponseBuilder;
|
|
||||||
|
|
||||||
@Readiness
|
|
||||||
@ApplicationScoped
|
|
||||||
public class SystemReadinessCheck implements HealthCheck {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
@ConfigProperty(name = "io_openliberty_guides_system_inMaintenance")
|
|
||||||
Provider<String> inMaintenance;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HealthCheckResponse call() {
|
|
||||||
HealthCheckResponseBuilder builder = HealthCheckResponse.named(
|
|
||||||
SystemResource.class.getSimpleName() + " readiness check");
|
|
||||||
if (inMaintenance != null && inMaintenance.get().equalsIgnoreCase("true")) {
|
|
||||||
return builder.withData("services", "not available").down().build();
|
|
||||||
}
|
|
||||||
return builder.withData("services", "available").up().build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package com.baeldung.openliberty;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
|
|
||||||
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.MediaType;
|
|
||||||
|
|
||||||
import org.eclipse.microprofile.metrics.annotation.Counted;
|
|
||||||
import org.eclipse.microprofile.metrics.annotation.Timed;
|
|
||||||
|
|
||||||
@RequestScoped
|
|
||||||
@Path("/properties")
|
|
||||||
public class SystemResource {
|
|
||||||
|
|
||||||
@GET
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
|
||||||
@Timed(name = "getPropertiesTime", description = "Time needed to get the JVM system properties")
|
|
||||||
@Counted(absolute = true, description = "Number of times the JVM system properties are requested")
|
|
||||||
public Response getProperties() {
|
|
||||||
return Response.ok(System.getProperties()).build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.baeldung.openliberty.hello;
|
package com.baeldung.openliberty.app;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -8,13 +8,13 @@ import javax.servlet.http.HttpServlet;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
@WebServlet(urlPatterns="/hello")
|
@WebServlet(urlPatterns="/app")
|
||||||
public class HelloServlet extends HttpServlet {
|
public class AppServlet extends HttpServlet {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
response.getWriter().append("Hello! How are you today?\n");
|
response.getWriter().append("<html><head><title>Open Liberty: greet</title></head><body><h2>Hello! Welcome to Open Liberty</h2></body></html>");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.baeldung.openliberty.user;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.FormParam;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
import com.baeldung.openliberty.user.dao.UserDao;
|
||||||
|
import com.baeldung.openliberty.user.model.User;
|
||||||
|
|
||||||
|
@RequestScoped
|
||||||
|
@Path("user")
|
||||||
|
public class UserResource {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
UserService userService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private UserDao userDAO;
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public User getUser() {
|
||||||
|
return userService.getUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method creates a new user from the submitted data (firstName, lastName and
|
||||||
|
* email)
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
||||||
|
@Transactional
|
||||||
|
public Response addNewUser(@FormParam("firstName") String firstName,
|
||||||
|
@FormParam("lastName") String lastName, @FormParam("email") String email) {
|
||||||
|
System.out.println(firstName);
|
||||||
|
System.out.println(lastName);
|
||||||
|
System.out.println(email);
|
||||||
|
User newUser = new User(firstName, lastName, email);
|
||||||
|
userDAO.createUser(newUser);
|
||||||
|
return Response.status(Response.Status.NO_CONTENT).build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.baeldung.openliberty.user;
|
||||||
|
|
||||||
|
import javax.enterprise.context.ApplicationScoped;
|
||||||
|
|
||||||
|
import com.baeldung.openliberty.user.model.User;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class UserService {
|
||||||
|
|
||||||
|
public User getUser() {
|
||||||
|
User user = new User();
|
||||||
|
user.setFirstName("Norman");
|
||||||
|
user.setLastName("Lewis");
|
||||||
|
user.setEmail("normanlewis@email.com");
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.baeldung.openliberty.user.dao;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.PersistenceContext;
|
||||||
|
|
||||||
|
import com.baeldung.openliberty.user.model.User;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
|
||||||
|
@RequestScoped
|
||||||
|
public class UserDao {
|
||||||
|
|
||||||
|
@PersistenceContext(name = "jpa-unit")
|
||||||
|
private EntityManager em;
|
||||||
|
|
||||||
|
public void createUser(User user) {
|
||||||
|
em.persist(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public User readUser(int userId) {
|
||||||
|
return em.find(User.class, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateUser(User user) {
|
||||||
|
em.merge(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteUser(User user) {
|
||||||
|
em.remove(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<User> readAllUsers() {
|
||||||
|
return em.createNamedQuery("User.findAll", User.class).getResultList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<User> findUser(String name, String location, String time) {
|
||||||
|
return em.createNamedQuery("User.findUser", User.class)
|
||||||
|
.setParameter("name", name)
|
||||||
|
.setParameter("location", location)
|
||||||
|
.setParameter("time", time).getResultList();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package com.baeldung.openliberty.user.model;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "Event")
|
||||||
|
public class User {
|
||||||
|
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
@Id
|
||||||
|
@Column(name = "id")
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
@Column(name = "first_name")
|
||||||
|
private String firstName;
|
||||||
|
|
||||||
|
@Column(name = "last_name")
|
||||||
|
private String lastName;
|
||||||
|
|
||||||
|
@Column(name = "email")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
public String getFirstName() {
|
||||||
|
return firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstName(String firstName) {
|
||||||
|
this.firstName = firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastName() {
|
||||||
|
return lastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastName(String lastName) {
|
||||||
|
this.lastName = lastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User(String firstName, String lastName, String email) {
|
||||||
|
super();
|
||||||
|
this.firstName = firstName;
|
||||||
|
this.lastName = lastName;
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,24 +1,51 @@
|
|||||||
<server description="Sample Liberty server">
|
<server description="Sample Liberty server">
|
||||||
<featureManager>
|
<featureManager>
|
||||||
<feature>jaxrs-2.1</feature>
|
<feature>appSecurity-2.0</feature>
|
||||||
<feature>jsonp-1.1</feature>
|
<feature>jaxrs-2.1</feature>
|
||||||
<feature>cdi-2.0</feature>
|
<feature>jsonp-1.1</feature>
|
||||||
<feature>mpMetrics-2.0</feature>
|
<feature>cdi-2.0</feature>
|
||||||
<feature>mpHealth-2.0</feature>
|
<feature>jpa-2.2</feature>
|
||||||
<feature>mpConfig-1.3</feature>
|
<feature>mpMetrics-2.0</feature>
|
||||||
</featureManager>
|
<feature>mpHealth-2.0</feature>
|
||||||
|
<feature>mpConfig-1.3</feature>
|
||||||
|
<feature>restConnector-2.0</feature>
|
||||||
|
<feature>jdbc-4.2</feature>
|
||||||
|
</featureManager>
|
||||||
|
|
||||||
<variable name="default.http.port" defaultValue="9080"/>
|
<keyStore id="defaultKeyStore" password="Liberty" />
|
||||||
<variable name="default.https.port" defaultValue="9443"/>
|
<quickStartSecurity userName="blogAdmin"
|
||||||
<variable name="app.context.root" defaultValue="sampleApp"/>
|
userPassword="blogAdminPassword" />
|
||||||
|
|
||||||
<webApplication location="guide-getting-started.war" contextRoot="/" />
|
|
||||||
<mpMetrics authentication="false"/>
|
|
||||||
|
|
||||||
<logging traceSpecification="com.ibm.ws.microprofile.health.*=all" />
|
<webApplication location="open-liberty.war"
|
||||||
|
contextRoot="/" />
|
||||||
|
<mpMetrics authentication="false" />
|
||||||
|
|
||||||
<httpEndpoint host="*" httpPort="${default.http.port}"
|
<logging
|
||||||
httpsPort="${default.https.port}" id="defaultHttpEndpoint"/>
|
traceSpecification="com.ibm.ws.microprofile.health.*=all" />
|
||||||
|
|
||||||
|
<httpEndpoint host="*" httpPort="${default.http.port}"
|
||||||
|
httpsPort="${default.https.port}" id="defaultHttpEndpoint" />
|
||||||
|
|
||||||
|
<variable name="io_openliberty_guides_system_inMaintenance"
|
||||||
|
value="false" />
|
||||||
|
|
||||||
|
<library id="derby">
|
||||||
|
<fileset dir="${shared.resource.dir}" includes="derby*.jar" />
|
||||||
|
</library>
|
||||||
|
|
||||||
|
<library id="H2JDBCLib">
|
||||||
|
<fileset dir="/lib" includes="h2-1.4.186.jar" />
|
||||||
|
</library>
|
||||||
|
|
||||||
|
<!-- <dataSource id="DefaultDataSource"> <jdbcDriver libraryRef="derby"
|
||||||
|
/> Example properties referencing an in-memory Derby Embedded database <properties.derby.embedded
|
||||||
|
databaseName="memory:defaultdb" createDatabase="create" user="dbuser" password="dbpass"
|
||||||
|
/> </dataSource> -->
|
||||||
|
<dataSource id="h2test" jndiName="jdbc/h2test">
|
||||||
|
<!-- Define the DataSource class names on the <jdbcDriver> element -->
|
||||||
|
<jdbcDriver libraryRef="H2JDBCLib" />
|
||||||
|
<properties URL="jdbc:h2:mem:testdb" />
|
||||||
|
</dataSource>
|
||||||
|
|
||||||
<variable name="io_openliberty_guides_system_inMaintenance" value="false"/>
|
|
||||||
</server>
|
</server>
|
24
open-liberty/src/main/resources/META-INF/persistence.xml
Normal file
24
open-liberty/src/main/resources/META-INF/persistence.xml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="2.2"
|
||||||
|
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
|
||||||
|
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
|
||||||
|
<!-- <persistence-unit name="jpa-unit"
|
||||||
|
transaction-type="JTA">
|
||||||
|
<jta-data-source>jdbc/libertyjpadatasource</jta-data-source>
|
||||||
|
<properties>
|
||||||
|
<property name="eclipselink.ddl-generation"
|
||||||
|
value="create-tables" />
|
||||||
|
<property name="eclipselink.ddl-generation.output-mode"
|
||||||
|
value="both" />
|
||||||
|
</properties>
|
||||||
|
</persistence-unit> -->
|
||||||
|
<persistence-unit name="h2test" transaction-type="JTA">
|
||||||
|
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
|
||||||
|
|
||||||
|
<jta-data-source>jdbc/h2test</jta-data-source>
|
||||||
|
|
||||||
|
<exclude-unlisted-classes>false</exclude-unlisted-classes>
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
Loading…
x
Reference in New Issue
Block a user