Save This Page
Home » openejb-3.1.2-src » org.apache » openejb » jee » [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   
   19   package org.apache.openejb.jee;
   20   
   21   import javax.xml.bind.annotation.XmlAccessType;
   22   import javax.xml.bind.annotation.XmlAccessorType;
   23   import javax.xml.bind.annotation.XmlAttribute;
   24   import javax.xml.bind.annotation.XmlElement;
   25   import javax.xml.bind.annotation.XmlID;
   26   import javax.xml.bind.annotation.XmlType;
   27   import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
   28   import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
   29   import java.util.ArrayList;
   30   import java.util.List;
   31   
   32   
   33   /**
   34    * The persistence-unit-ref element contains a declaration
   35    * of Deployment Component's reference to a persistence unit
   36    * associated within a Deployment Component's
   37    * environment. It consists of:
   38    * <p/>
   39    * - an optional description
   40    * - the persistence unit reference name
   41    * - an optional persistence unit name.  If not specified,
   42    * the default persistence unit is assumed.
   43    * - optional injection targets
   44    * <p/>
   45    * Examples:
   46    * <p/>
   47    * <persistence-unit-ref>
   48    * <persistence-unit-ref-name>myPersistenceUnit
   49    * </persistence-unit-ref-name>
   50    * </persistence-unit-ref>
   51    * <p/>
   52    * <persistence-unit-ref>
   53    * <persistence-unit-ref-name>myPersistenceUnit
   54    * </persistence-unit-ref-name>
   55    * <persistence-unit-name>PersistenceUnit1
   56    * </persistence-unit-name>
   57    * </persistence-unit-ref>
   58    */
   59   @XmlAccessorType(XmlAccessType.FIELD)
   60   @XmlType(name = "persistence-unit-refType", propOrder = {
   61           "description",
   62           "persistenceUnitRefName",
   63           "persistenceUnitName",
   64           "mappedName",
   65           "injectionTarget"
   66           })
   67   public class PersistenceUnitRef implements JndiReference, PersistenceRef {
   68   
   69       @XmlElement(required = true)
   70       protected List<Text> description;
   71       @XmlElement(name = "persistence-unit-ref-name", required = true)
   72       protected String persistenceUnitRefName;
   73       @XmlElement(name = "persistence-unit-name")
   74       protected String persistenceUnitName;
   75       @XmlElement(name = "mapped-name")
   76       protected String mappedName;
   77       @XmlElement(name = "injection-target", required = true)
   78       protected List<InjectionTarget> injectionTarget;
   79       @XmlAttribute
   80       @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
   81       @XmlID
   82       protected String id;
   83   
   84   
   85       public PersistenceUnitRef() {
   86       }
   87   
   88       public PersistenceUnitRef(String persistenceUnitRefName, String persistenceUnitName) {
   89           this.persistenceUnitRefName = persistenceUnitRefName;
   90           this.persistenceUnitName = persistenceUnitName;
   91       }
   92   
   93       public String getName() {
   94           return getPersistenceUnitRefName();
   95       }
   96   
   97       public String getType() {
   98           return getPersistenceUnitName();
   99       }
  100   
  101       public void setName(String name) {
  102           setPersistenceUnitRefName(name);
  103       }
  104   
  105       public String getKey() {
  106           return getName();
  107       }
  108   
  109       public void setType(String type) {
  110       }
  111   
  112       public List<Text> getDescription() {
  113           if (description == null) {
  114               description = new ArrayList<Text>();
  115           }
  116           return this.description;
  117       }
  118   
  119       public String getPersistenceUnitRefName() {
  120           return persistenceUnitRefName;
  121       }
  122   
  123       public void setPersistenceUnitRefName(String value) {
  124           this.persistenceUnitRefName = value;
  125       }
  126   
  127       public String getPersistenceUnitName() {
  128           return persistenceUnitName;
  129       }
  130   
  131       public void setPersistenceUnitName(String value) {
  132           this.persistenceUnitName = value;
  133       }
  134   
  135       public String getMappedName() {
  136           return mappedName;
  137       }
  138   
  139       public void setMappedName(String value) {
  140           this.mappedName = value;
  141       }
  142   
  143       public List<InjectionTarget> getInjectionTarget() {
  144           if (injectionTarget == null) {
  145               injectionTarget = new ArrayList<InjectionTarget>();
  146           }
  147           return this.injectionTarget;
  148       }
  149   
  150       public String getId() {
  151           return id;
  152       }
  153   
  154       public void setId(String value) {
  155           this.id = value;
  156       }
  157   
  158   }

Save This Page
Home » openejb-3.1.2-src » org.apache » openejb » jee » [javadoc | source]