Home » openejb-3.1.2-src » org.apache » openejb » jee » jpa » unit » [javadoc | source]

    1   /**
    2    *
    3    * Licensed to the Apache Software Foundation (ASF) under one or more
    4    * contributor license agreements.  See the NOTICE file distributed with
    5    * this work for additional information regarding copyright ownership.
    6    * The ASF licenses this file to You under the Apache License, Version 2.0
    7    * (the "License"); you may not use this file except in compliance with
    8    * the License.  You may obtain a copy of the License at
    9    *
   10    *     http://www.apache.org/licenses/LICENSE-2.0
   11    *
   12    *  Unless required by applicable law or agreed to in writing, software
   13    *  distributed under the License is distributed on an "AS IS" BASIS,
   14    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   15    *  See the License for the specific language governing permissions and
   16    *  limitations under the License.
   17    */
   18   package org.apache.openejb.jee.jpa.unit;
   19   
   20   import javax.xml.bind.annotation.XmlAccessorType;
   21   import javax.xml.bind.annotation.XmlAccessType;
   22   import javax.xml.bind.annotation.XmlType;
   23   import javax.xml.bind.annotation.XmlElement;
   24   import javax.xml.bind.annotation.XmlAttribute;
   25   import javax.xml.bind.annotation.XmlTransient;
   26   import java.util.List;
   27   import java.util.ArrayList;
   28   
   29   /**
   30    *
   31    *                 Configuration of a persistence unit.
   32    *
   33    *
   34    * <p>Java class for anonymous complex type.
   35    *
   36    * <p>The following schema fragment specifies the expected content contained within this class.
   37    *
   38    * <pre>
   39    * &lt;complexType>
   40    *   &lt;complexContent>
   41    *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
   42    *       &lt;sequence>
   43    *         &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
   44    *         &lt;element name="provider" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
   45    *         &lt;element name="jta-data-source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
   46    *         &lt;element name="non-jta-data-source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
   47    *         &lt;element name="mapping-file" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
   48    *         &lt;element name="jar-file" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
   49    *         &lt;element name="class" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
   50    *         &lt;element name="exclude-unlisted-classes" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
   51    *         &lt;element name="properties" minOccurs="0">
   52    *           &lt;complexType>
   53    *             &lt;complexContent>
   54    *               &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
   55    *                 &lt;sequence>
   56    *                   &lt;element name="property" maxOccurs="unbounded" minOccurs="0">
   57    *                     &lt;complexType>
   58    *                       &lt;complexContent>
   59    *                         &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
   60    *                           &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
   61    *                           &lt;attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
   62    *                         &lt;/restriction>
   63    *                       &lt;/complexContent>
   64    *                     &lt;/complexType>
   65    *                   &lt;/element>
   66    *                 &lt;/sequence>
   67    *               &lt;/restriction>
   68    *             &lt;/complexContent>
   69    *           &lt;/complexType>
   70    *         &lt;/element>
   71    *       &lt;/sequence>
   72    *       &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
   73    *       &lt;attribute name="transaction-type" type="{http://java.sun.com/xml/ns/persistence}persistence-unit-transaction-type" />
   74    *     &lt;/restriction>
   75    *   &lt;/complexContent>
   76    * &lt;/complexType>
   77    * </pre>
   78    *
   79    *
   80    */
   81   @XmlAccessorType(XmlAccessType.FIELD)
   82   @XmlType(name = "", propOrder = {
   83       "description",
   84       "provider",
   85       "jtaDataSource",
   86       "nonJtaDataSource",
   87       "mappingFile",
   88       "jarFile",
   89       "clazz",
   90       "excludeUnlistedClasses",
   91       "properties"
   92   })
   93   public class PersistenceUnit {
   94   
   95       @XmlTransient
   96       private String id;
   97   
   98       protected String description;
   99       protected String provider;
  100       @XmlElement(name = "jta-data-source")
  101       protected String jtaDataSource;
  102       @XmlElement(name = "non-jta-data-source")
  103       protected String nonJtaDataSource;
  104       @XmlElement(name = "mapping-file", required = true)
  105       protected List<String> mappingFile;
  106       @XmlElement(name = "jar-file", required = true)
  107       protected List<String> jarFile;
  108       @XmlElement(name = "class", required = true)
  109       protected List<String> clazz;
  110       @XmlElement(name = "exclude-unlisted-classes", defaultValue = "false")
  111       protected Boolean excludeUnlistedClasses;
  112       protected Properties properties;
  113       @XmlAttribute(required = true)
  114       protected String name;
  115       @XmlAttribute(name = "transaction-type")
  116       protected TransactionType transactionType;
  117   
  118       public PersistenceUnit(String name, String provider) {
  119           this.name = name;
  120           this.provider = provider;
  121       }
  122   
  123       public PersistenceUnit() {
  124       }
  125   
  126       public PersistenceUnit(String unitName) {
  127           this.name = unitName;
  128       }
  129   
  130       public String getId() {
  131           return id;
  132       }
  133   
  134       public void setId(String id) {
  135           this.id = id;
  136       }
  137   
  138       public String getDescription() {
  139           return description;
  140       }
  141   
  142       public void setDescription(String value) {
  143           this.description = value;
  144       }
  145   
  146       public String getProvider() {
  147           return provider;
  148       }
  149   
  150       public void setProvider(String value) {
  151           this.provider = value;
  152       }
  153   
  154       public String getJtaDataSource() {
  155           return jtaDataSource;
  156       }
  157   
  158       public void setJtaDataSource(String value) {
  159           this.jtaDataSource = value;
  160       }
  161   
  162       public String getNonJtaDataSource() {
  163           return nonJtaDataSource;
  164       }
  165   
  166       public void setNonJtaDataSource(String value) {
  167           this.nonJtaDataSource = value;
  168       }
  169   
  170       public List<String> getMappingFile() {
  171           if (mappingFile == null) {
  172               mappingFile = new ArrayList<String>();
  173           }
  174           return this.mappingFile;
  175       }
  176   
  177       public List<String> getJarFile() {
  178           if (jarFile == null) {
  179               jarFile = new ArrayList<String>();
  180           }
  181           return this.jarFile;
  182       }
  183   
  184       public List<String> getClazz() {
  185           if (clazz == null) {
  186               clazz = new ArrayList<String>();
  187           }
  188           return this.clazz;
  189       }
  190   
  191       public Boolean isExcludeUnlistedClasses() {
  192           return excludeUnlistedClasses;
  193       }
  194   
  195       public void setExcludeUnlistedClasses(Boolean value) {
  196           this.excludeUnlistedClasses = value;
  197       }
  198   
  199       public Properties getProperties() {
  200           return properties;
  201       }
  202   
  203       public void setProperties(Properties value) {
  204           this.properties = value;
  205       }
  206   
  207       public String getName() {
  208           return name;
  209       }
  210   
  211       public void setName(String value) {
  212           this.name = value;
  213       }
  214   
  215       public TransactionType getTransactionType() {
  216           // TODO: Is this the correct default?
  217           return (transactionType == null)? TransactionType.JTA: transactionType;
  218       }
  219   
  220       public void setTransactionType(TransactionType value) {
  221           this.transactionType = value;
  222       }
  223   
  224   
  225   }

Home » openejb-3.1.2-src » org.apache » openejb » jee » jpa » unit » [javadoc | source]