Skip to content

Package: UserEntityManagerFactory

UserEntityManagerFactory

nameinstructionbranchcomplexitylinemethod
UserEntityManagerFactory()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getInstance()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.service.user.internal;
14:
15: import java.util.HashMap;
16: import java.util.Map;
17:
18: import org.eclipse.kapua.commons.jpa.AbstractEntityManagerFactory;
19: import org.eclipse.kapua.commons.jpa.EntityManager;
20: import org.eclipse.kapua.commons.jpa.EntityManagerFactory;
21: import org.slf4j.Logger;
22: import org.slf4j.LoggerFactory;
23:
24: /**
25: * Entity manager factory for the user module.
26: *
27: * @since 1.0
28: *
29: */
30: public class UserEntityManagerFactory extends AbstractEntityManagerFactory implements EntityManagerFactory {
31:
32: @SuppressWarnings("unused")
33: private static final Logger LOG = LoggerFactory.getLogger(UserEntityManagerFactory.class);
34:
35: private static final String PERSISTENCE_UNIT_NAME = "kapua-user";
36: private static final String DATASOURCE_NAME = "kapua-dbpool";
37: private static final Map<String, String> UNIQUE_CONSTRAINTS = new HashMap<>();
38:
39: private static UserEntityManagerFactory instance = new UserEntityManagerFactory();
40:
41: /**
42: * Constructs a new entity manager factory and configure it to use the user persistence unit.
43: */
44: private UserEntityManagerFactory() {
45: super(PERSISTENCE_UNIT_NAME, DATASOURCE_NAME, UNIQUE_CONSTRAINTS);
46: }
47:
48: /**
49: * Return the {@link EntityManager} singleton instance
50: *
51: * @return
52: */
53: public static UserEntityManagerFactory getInstance() {
54: return instance;
55: }
56: }