Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
import jakarta.persistence.EntityTransaction;
import jakarta.persistence.OptimisticLockException;
import jakarta.persistence.Persistence;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -117,14 +119,23 @@ public PolarisEclipseLinkMetaStoreSessionImpl(
this.storageIntegrationProvider = storageIntegrationProvider;
}

private InputStream loadFile(String path) throws FileNotFoundException {
InputStream input = null;
input = this.getClass().getClassLoader().getResourceAsStream(path);
if (input == null) {
input = new FileInputStream(path);
}
return input;
}

/** Load the persistence unit properties from a given configuration file */
private Map<String, String> loadProperties(String confFile, String persistenceUnitName) {
if (this.properties != null) {
return this.properties;
}

try {
InputStream input = this.getClass().getClassLoader().getResourceAsStream(confFile);
InputStream input = loadFile(confFile);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(input);
Expand Down