KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > polepos > teams > jdo > JdoTeam


1 /*
2 This file is part of the PolePosition database benchmark
3 http://www.polepos.org
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public
16 License along with this program; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18 MA 02111-1307, USA. */

19
20 package org.polepos.teams.jdo;
21
22 import java.util.*;
23
24 import org.polepos.framework.*;
25
26
27 public class JdoTeam extends Team{
28     
29     private final Car[] mCars;
30     
31     public JdoTeam() {
32         
33         String JavaDoc[] impls = Jdo.settings().getJdoImplementations();
34         
35         if(impls == null){
36             System.out.println("No JDO engine configured.");
37             mCars = new Car[0];
38         }else{
39         
40             List <Car> cars = new ArrayList<Car>();
41             
42             for (String JavaDoc impl : impls) {
43                 
44                 String JavaDoc[] jdosqldbs = Jdo.settings().getJdbc(impl);
45                 
46                 if(jdosqldbs != null && jdosqldbs.length > 0){
47                     for(String JavaDoc sqldb : jdosqldbs){
48                         try {
49                             cars.add(new JdoCar(impl, sqldb));
50                         } catch (Exception JavaDoc e) {
51                             e.printStackTrace();
52                         }
53                     }
54                 }else{
55                     try {
56                         cars.add(new JdoCar(impl, null));
57                     } catch (Exception JavaDoc e) {
58                         e.printStackTrace();
59                     }
60                 }
61             }
62             
63             mCars = new Car[ cars.size() ];
64             cars.toArray(mCars);
65         }
66         
67     }
68     
69     
70     @Override JavaDoc
71     public String JavaDoc name(){
72         return "JDO";
73     }
74
75     @Override JavaDoc
76     public String JavaDoc description() {
77         return "the JDO team";
78     }
79
80     @Override JavaDoc
81     public Car[] cars(){
82         return mCars;
83     }
84     
85     @Override JavaDoc
86     public Driver[] drivers() {
87         return new Driver[]{
88             new MelbourneJdo(),
89             new SepangJdo(),
90             new BahrainJdo(),
91             new ImolaJdo(),
92             new BarcelonaJdo()
93         };
94     }
95     
96     @Override JavaDoc
97     public String JavaDoc website() {
98         return null;
99     }
100
101
102     
103 }
104
Popular Tags