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   
   21   package org.apache.geronimo.farm.plugin;
   22   
   23   import java.util.ArrayList;
   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.JoinColumn;
   31   import javax.persistence.JoinTable;
   32   import javax.persistence.ManyToMany;
   33   import javax.persistence.NamedQuery;
   34   
   35   import org.apache.geronimo.system.plugin.model.PluginListType;
   36   import org.apache.geronimo.system.plugin.model.PluginType;
   37   
   38   /**
   39    * @version $Rev: 693703 $ $Date: 2008-09-09 21:20:53 -0700 (Tue, 09 Sep 2008) $
   40    */
   41   @Entity(name = "pluginlist")
   42   @NamedQuery(name = "pluginListByName", query = "SELECT a FROM pluginlist a WHERE a.name = :name")
   43   public class JpaPluginList {
   44       @Id
   45       private String name;
   46       @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE},
   47               fetch = FetchType.EAGER)
   48       private List<JpaPluginInstance> plugins = new ArrayList<JpaPluginInstance>();
   49       @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE},
   50               fetch = FetchType.EAGER)
   51       @JoinTable(name = "pluginlist_cluster",
   52               joinColumns = {@JoinColumn(name = "pluginlist_name")},
   53               inverseJoinColumns = {@JoinColumn(name = "cluster_name")}
   54       )
   55       private List<JpaClusterInfo> clusters = new ArrayList<JpaClusterInfo>();
   56       private String defaultPluginRepository;
   57   
   58       public String getName() {
   59           return name;
   60       }
   61   
   62       public void setName(String name) {
   63           this.name = name;
   64       }
   65   
   66       public List<JpaPluginInstance> getPlugins() {
   67           return plugins;
   68       }
   69   
   70       public void setPlugins(List<JpaPluginInstance> plugins) {
   71           this.plugins = plugins;
   72       }
   73   
   74       public List<JpaClusterInfo> getClusters() {
   75           return clusters;
   76       }
   77   
   78       public void setClusters(List<JpaClusterInfo> clusters) {
   79           this.clusters = clusters;
   80       }
   81   
   82       public String getDefaultPluginRepository() {
   83           return defaultPluginRepository;
   84       }
   85   
   86       public void setDefaultPluginRepository(String defaultPluginRepository) {
   87           this.defaultPluginRepository = defaultPluginRepository;
   88       }
   89   
   90       public PluginListType getPluginList() {
   91           PluginListType pluginList = new PluginListType();
   92           List<PluginType> plugins = pluginList.getPlugin();
   93           for (JpaPluginInstance pluginInstance : this.plugins) {
   94               PluginType plugin = pluginInstance.getPlugin();
   95               plugins.add(plugin);
   96           }
   97           if (defaultPluginRepository != null) {
   98               pluginList.getDefaultRepository().add(defaultPluginRepository);
   99           }
  100           return pluginList;
  101       }
  102   }

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