View Javadoc

1   package org.apache.maven.continuum.management;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /**
23   * Enumeration of known database formats.
24   * @version $Id: DatabaseFormat.java 729479 2008-12-26 10:52:45Z olamy $
25   */
26  public enum DatabaseFormat
27  {
28      /**
29       * Continuum 1.0.3 build database.
30       *
31       * @todo this hasn't been completed/tested - the model needs to be annotated with 1.0.3 metadata and converters written.
32       */
33      CONTINUUM_103( "1.1.1", "legacy-continuum-jdo" )
34          {
35              public boolean isConvertibleFrom( DatabaseFormat sourceFormat )
36              {
37                  return false;
38              }
39          },
40  
41      /**
42       * Continuum pre-alpha build database. Plexus Security 1.0-alpha-5.
43       */
44      CONTINUUM_109( "1.1.1", "legacy-continuum-jdo", "legacy-redback-jdo" )
45          {
46              public boolean isConvertibleFrom( DatabaseFormat sourceFormat )
47              {
48                  return false;
49              }
50          },
51  
52      /**
53       * Continuum 1.1+ build database.
54       */
55      CONTINUUM_11( "1.1.6", "continuum-jdo", "redback-jdo" )
56          {
57              public boolean isConvertibleFrom( DatabaseFormat sourceFormat )
58              {
59                  return sourceFormat == CONTINUUM_103 || sourceFormat == CONTINUUM_109;
60              }
61          };
62  
63      private final String jpoxVersion;
64  
65      private final String continuumToolRoleHint;
66  
67      private final String redbackToolRoleHint;
68  
69      DatabaseFormat( String jpoxVersion, String continuumToolRoleHint )
70      {
71          this.jpoxVersion = jpoxVersion;
72  
73          this.continuumToolRoleHint = continuumToolRoleHint;
74  
75          this.redbackToolRoleHint = null;
76      }
77  
78      DatabaseFormat( String jpoxVersion, String continuumToolRoleHint, String redbackToolRoleHint )
79      {
80          this.jpoxVersion = jpoxVersion;
81  
82          this.continuumToolRoleHint = continuumToolRoleHint;
83  
84          this.redbackToolRoleHint = redbackToolRoleHint;
85      }
86  
87      /**
88       * Whether a database can be converted from the given format to this format.
89       *
90       * @param sourceFormat the database format to convert from
91       * @return whether it can be successfully converted from that format
92       */
93      public abstract boolean isConvertibleFrom( DatabaseFormat sourceFormat );
94  
95      public String getJpoxVersion()
96      {
97          return jpoxVersion;
98      }
99  
100     public String getContinuumToolRoleHint()
101     {
102         return continuumToolRoleHint;
103     }
104 
105     public String getRedbackToolRoleHint()
106     {
107         return redbackToolRoleHint;
108     }
109 }