Home » geronimo-2.2-source-release » org.apache.geronimo.farm.plugin » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one
    3    * or more contributor license agreements.  See the NOTICE file
    4    * distributed with this work for additional information
    5    * regarding copyright ownership.  The ASF licenses this file
    6    * to you under the Apache License, Version 2.0 (the
    7    * "License"); you may not use this file except in compliance
    8    * with 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,
   13    * software distributed under the License is distributed on an
   14    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   15    * KIND, either express or implied.  See the License for the
   16    * specific language governing permissions and limitations
   17    * under the License.
   18    */
   19   
   20   package org.apache.geronimo.farm.plugin;
   21   
   22   import java.util.ArrayList;
   23   import java.util.Collection;
   24   import java.util.List;
   25   
   26   import javax.persistence.CascadeType;
   27   import javax.persistence.Entity;
   28   import javax.persistence.FetchType;
   29   import javax.persistence.Id;
   30   import javax.persistence.ManyToMany;
   31   import javax.persistence.NamedQuery;
   32   import javax.persistence.OneToMany;
   33   
   34   import org.apache.geronimo.farm.config.ClusterInfo;
   35   import org.apache.geronimo.farm.config.NodeInfo;
   36   
   37   /**
   38    * @version $Rev:$ $Date:$
   39    */
   40   @Entity(name = "cluster")
   41   @NamedQuery(name = "clusterByName", query = "SELECT a FROM cluster a WHERE a.name = :name")
   42   
   43   public class JpaClusterInfo implements ClusterInfo {
   44   
   45       @Id
   46       private String name;
   47       @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE},
   48               fetch = FetchType.EAGER,
   49               mappedBy = "cluster")
   50       private List<JpaNodeInfo> nodes = new ArrayList<JpaNodeInfo>();
   51   
   52       @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE},
   53               mappedBy = "clusters",
   54               fetch = FetchType.EAGER)
   55       private List<JpaPluginList> pluginLists = new ArrayList<JpaPluginList>();
   56   
   57       public String getName() {
   58           return name;
   59       }
   60   
   61       public void setName(String name) {
   62           this.name = name;
   63       }
   64   
   65       public Collection<NodeInfo> getNodeInfos() {
   66           return new ArrayList<NodeInfo>(nodes);
   67       }
   68   
   69       public List<JpaPluginList> getPluginLists() {
   70           return pluginLists;
   71       }
   72   
   73       public List<JpaNodeInfo> getJpaNodeInfos() {
   74           return nodes;
   75       }
   76   }

Home » geronimo-2.2-source-release » org.apache.geronimo.farm.plugin » [javadoc | source]