Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
DataMigration | 32 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software 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 GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package com.xpn.xwiki.store.migration; | |
21 | ||
22 | import org.xwiki.component.annotation.Role; | |
23 | ||
24 | /** | |
25 | * Interface for data migration. New data migration should be named like "R"+vernum+issuenumber+"DataMigration" to | |
26 | * prevent collisions. | |
27 | * | |
28 | * @version $Id: 7a4a9da4f227e6004b4fa17d835454b3151ac4e3 $ | |
29 | * @since 3.4M1 | |
30 | */ | |
31 | @Role | |
32 | public interface DataMigration | |
33 | { | |
34 | /** | |
35 | * @return the data migration hint. For example "R4340XWIKI883". | |
36 | */ | |
37 | String getName(); | |
38 | ||
39 | /** | |
40 | * @return a description of what the data migration does | |
41 | */ | |
42 | String getDescription(); | |
43 | ||
44 | /** | |
45 | * @return data version which need migration. before you commit stuff which needs migration, you need write data | |
46 | * migration with version = current release number (i.e 32000 for release 3.2). | |
47 | */ | |
48 | XWikiDBVersion getVersion(); | |
49 | ||
50 | /** | |
51 | * Run migration. | |
52 | * | |
53 | * @throws DataMigrationException if any error | |
54 | */ | |
55 | void migrate() throws DataMigrationException; | |
56 | ||
57 | /** | |
58 | * @param startupVersion the database version when the migration process starts (before any dataMigration is | |
59 | * applied). This is useful for data migration which need to run only when the database is in a certain | |
60 | * version. | |
61 | * @return true if the migration should be executed or false otherwise | |
62 | */ | |
63 | boolean shouldExecute(XWikiDBVersion startupVersion); | |
64 | } |