forked from jenkinsci/database-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPersistenceUnitInfoImpl.java
More file actions
117 lines (93 loc) · 2.94 KB
/
Copy pathPersistenceUnitInfoImpl.java
File metadata and controls
117 lines (93 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package org.jenkinsci.plugins.database.jpa;
import jakarta.persistence.SharedCacheMode;
import jakarta.persistence.ValidationMode;
import jakarta.persistence.spi.ClassTransformer;
import jakarta.persistence.spi.PersistenceUnitInfo;
import jakarta.persistence.spi.PersistenceUnitTransactionType;
import javax.sql.DataSource;
import java.net.URL;
import java.util.AbstractList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
/**
*
* @author Kohsuke Kawaguchi
*/
class PersistenceUnitInfoImpl implements PersistenceUnitInfo {
private DataSource dataSource;
private List<Class> classes;
private ClassLoader classLoader;
public PersistenceUnitInfoImpl(DataSource dataSource, List<Class> classes, ClassLoader classLoader) {
this.dataSource = dataSource;
this.classes = classes;
this.classLoader = classLoader;
}
public String getPersistenceUnitName() {
return "TODO"; // ???
}
public String getPersistenceProviderClassName() {
return null; // ???
}
public PersistenceUnitTransactionType getTransactionType() {
return PersistenceUnitTransactionType.RESOURCE_LOCAL;
}
public DataSource getJtaDataSource() {
return null;
}
public DataSource getNonJtaDataSource() {
return dataSource;
}
public List<String> getMappingFileNames() {
return Collections.emptyList();
}
public List<URL> getJarFileUrls() {
return Collections.emptyList();
}
public URL getPersistenceUnitRootUrl() {
return null; // prevent Hibernate from trying to auto discover classes as it won't work
// try {
// return new URL("file:///tmp/no-such-file");
// } catch (MalformedURLException e) {
// throw new Error(e);
// }
}
public List<String> getManagedClassNames() {
return new AbstractList<String>() {
@Override
public String get(int index) {
return classes.get(index).getName();
}
@Override
public int size() {
return classes.size();
}
};
}
public boolean excludeUnlistedClasses() {
return true;
}
public Properties getProperties() {
Properties properties = new Properties();
properties.put("hibernate.hbm2ddl.auto","update");
return properties;
}
public ClassLoader getClassLoader() {
return classLoader;
}
public void addTransformer(ClassTransformer transformer) {
throw new UnsupportedOperationException();
}
public ClassLoader getNewTempClassLoader() {
return classLoader;
}
public SharedCacheMode getSharedCacheMode() {
return SharedCacheMode.UNSPECIFIED;
}
public ValidationMode getValidationMode() {
return ValidationMode.AUTO;
}
public String getPersistenceXMLSchemaVersion() {
return null;
}
}