com.guicedee.guicedpersistence.db.intercepters.JPADefaultConnectionBaseBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of guiced-persistence Show documentation
Show all versions of guiced-persistence Show documentation
A complete JPA 2.1 implementation for Standalone or EE Implementation. Enables Multiple Persistence units
with full JTA Support using BTM. Perfect for Guice implementations, test suites, and Guice enabled Web Applications or EAR Projects.
Requires JDK 8
package com.guicedee.guicedpersistence.db.intercepters;
import com.guicedee.guicedpersistence.db.ConnectionBaseInfo;
import com.guicedee.guicedpersistence.services.IPropertiesConnectionInfoReader;
import com.oracle.jaxb21.PersistenceUnit;
import java.util.Properties;
public class JPADefaultConnectionBaseBuilder
implements IPropertiesConnectionInfoReader
{
@Override
public ConnectionBaseInfo populateConnectionBaseInfo(PersistenceUnit unit, Properties filteredProperties, ConnectionBaseInfo cbi)
{
for (String prop : filteredProperties.stringPropertyNames())
{
switch (prop)
{
case "javax.persistence.jdbc.url":
{
cbi.setUrl(filteredProperties.getProperty(prop));
break;
}
case "javax.persistence.jdbc.user":
{
cbi.setUsername(filteredProperties.getProperty(prop));
break;
}
case "javax.persistence.jdbc.password":
{
cbi.setPassword(filteredProperties.getProperty(prop));
break;
}
case "javax.persistence.jdbc.driver":
{
cbi.setDriverClass(filteredProperties.getProperty(prop));
break;
}
default:
{
break;
}
}
}
return cbi;
}
}