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 *
25 * @version $Id: DatabaseFormat.java 1372260 2012-08-13 04:29:09Z brett $
26 */
27 public enum DatabaseFormat
28 {
29 /**
30 * Continuum 1.0.3 build database.
31 *
32 * @todo this hasn't been completed/tested - the model needs to be annotated with 1.0.3 metadata and converters written.
33 */
34 CONTINUUM_103( "1.1.1", "legacy-continuum-jdo" )
35 {
36 public boolean isConvertibleFrom( DatabaseFormat sourceFormat )
37 {
38 return false;
39 }
40 },
41
42 /**
43 * Continuum pre-alpha build database. Plexus Security 1.0-alpha-5.
44 */
45 CONTINUUM_109( "1.1.1", "legacy-continuum-jdo", "legacy-redback-jdo" )
46 {
47 public boolean isConvertibleFrom( DatabaseFormat sourceFormat )
48 {
49 return false;
50 }
51 },
52
53 /**
54 * Continuum 1.1+ build database.
55 */
56 CONTINUUM_11( "1.1.6", "continuum-jdo", "redback-jdo" )
57 {
58 public boolean isConvertibleFrom( DatabaseFormat sourceFormat )
59 {
60 return sourceFormat == CONTINUUM_103 || sourceFormat == CONTINUUM_109;
61 }
62 };
63
64 private final String jpoxVersion;
65
66 private final String continuumToolRoleHint;
67
68 private final String redbackToolRoleHint;
69
70 DatabaseFormat( String jpoxVersion, String continuumToolRoleHint )
71 {
72 this.jpoxVersion = jpoxVersion;
73
74 this.continuumToolRoleHint = continuumToolRoleHint;
75
76 this.redbackToolRoleHint = null;
77 }
78
79 DatabaseFormat( String jpoxVersion, String continuumToolRoleHint, String redbackToolRoleHint )
80 {
81 this.jpoxVersion = jpoxVersion;
82
83 this.continuumToolRoleHint = continuumToolRoleHint;
84
85 this.redbackToolRoleHint = redbackToolRoleHint;
86 }
87
88 /**
89 * Whether a database can be converted from the given format to this format.
90 *
91 * @param sourceFormat the database format to convert from
92 * @return whether it can be successfully converted from that format
93 */
94 public abstract boolean isConvertibleFrom( DatabaseFormat sourceFormat );
95
96 public String getJpoxVersion()
97 {
98 return jpoxVersion;
99 }
100
101 public String getContinuumToolRoleHint()
102 {
103 return continuumToolRoleHint;
104 }
105
106 public String getRedbackToolRoleHint()
107 {
108 return redbackToolRoleHint;
109 }
110 }