org.apache.openejb.jee.jpa.unit.PersistenceUnit Maven / Gradle / Ivy
/**
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.openejb.jee.jpa.unit;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlTransient;
import java.util.List;
import java.util.ArrayList;
/**
*
* Configuration of a persistence unit.
*
*
* Java class for anonymous complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="provider" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="jta-data-source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="non-jta-data-source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="mapping-file" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
* <element name="jar-file" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
* <element name="class" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
* <element name="exclude-unlisted-classes" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* <element name="properties" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="property" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="transaction-type" type="{http://java.sun.com/xml/ns/persistence}persistence-unit-transaction-type" />
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"description",
"provider",
"jtaDataSource",
"nonJtaDataSource",
"mappingFile",
"jarFile",
"clazz",
"excludeUnlistedClasses",
"properties"
})
public class PersistenceUnit {
@XmlTransient
private String id;
protected String description;
protected String provider;
@XmlElement(name = "jta-data-source")
protected String jtaDataSource;
@XmlElement(name = "non-jta-data-source")
protected String nonJtaDataSource;
@XmlElement(name = "mapping-file", required = true)
protected List mappingFile;
@XmlElement(name = "jar-file", required = true)
protected List jarFile;
@XmlElement(name = "class", required = true)
protected List clazz;
@XmlElement(name = "exclude-unlisted-classes", defaultValue = "false")
protected Boolean excludeUnlistedClasses;
protected Properties properties;
@XmlAttribute(required = true)
protected String name;
@XmlAttribute(name = "transaction-type")
protected TransactionType transactionType;
public PersistenceUnit(String name, String provider) {
this.name = name;
this.provider = provider;
}
public PersistenceUnit() {
}
public PersistenceUnit(String unitName) {
this.name = unitName;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String value) {
this.description = value;
}
public String getProvider() {
return provider;
}
public void setProvider(String value) {
this.provider = value;
}
public String getJtaDataSource() {
return jtaDataSource;
}
public void setJtaDataSource(String value) {
this.jtaDataSource = value;
}
public String getNonJtaDataSource() {
return nonJtaDataSource;
}
public void setNonJtaDataSource(String value) {
this.nonJtaDataSource = value;
}
public List getMappingFile() {
if (mappingFile == null) {
mappingFile = new ArrayList();
}
return this.mappingFile;
}
public List getJarFile() {
if (jarFile == null) {
jarFile = new ArrayList();
}
return this.jarFile;
}
public List getClazz() {
if (clazz == null) {
clazz = new ArrayList();
}
return this.clazz;
}
public Boolean isExcludeUnlistedClasses() {
return excludeUnlistedClasses;
}
public void setExcludeUnlistedClasses(Boolean value) {
this.excludeUnlistedClasses = value;
}
public Properties getProperties() {
return properties;
}
public void setProperties(Properties value) {
this.properties = value;
}
public String getName() {
return name;
}
public void setName(String value) {
this.name = value;
}
public TransactionType getTransactionType() {
// TODO: Is this the correct default?
return (transactionType == null)? TransactionType.JTA: transactionType;
}
public void setTransactionType(TransactionType value) {
this.transactionType = value;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy