KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > admin > patch > Patch


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.repo.admin.patch;
18
19 import java.util.List JavaDoc;
20
21 import org.alfresco.service.cmr.admin.PatchException;
22
23 /**
24  * A patch is an executable class that makes a change to persisted data.
25  * <p>
26  * Auditing information is not maintained by the patch - rather it is solely
27  * responsible for the execution of the processes necessary to apply the patch.
28  * <p>
29  * Patches must not be reappliable. It is up to the patch management systems
30  * to ensure that patches are <b>never reapplied</b>.
31  *
32  * @see org.alfresco.repo.admin.patch.AbstractPatch
33  * @since 1.2
34  * @author Derek Hulley
35  */

36 public interface Patch
37 {
38     public String JavaDoc getId();
39     
40     public String JavaDoc getDescription();
41     
42     /**
43      * @return Returns the smallest schema number that this patch may be applied to
44      */

45     public int getFixesFromSchema();
46
47     /**
48      * @return Returns the largest schema number that this patch may be applied to
49      */

50     public int getFixesToSchema();
51     
52     /**
53      * @return Returns the schema number that this patch attempts to bring the repo up to
54      */

55     public int getTargetSchema();
56
57     /**
58      * Get patches that this patch depends on
59      *
60      * @return Returns a list of patches
61      */

62     public List JavaDoc<Patch> getDependsOn();
63     
64     /**
65      * Check if the patch is applicable to a given schema version.
66      *
67      * @param version a schema version number
68      * @return Returns <code>(fixesFromVersion <= version <= fixesToVersion)</code>
69      */

70     public boolean applies(int version);
71     
72     /**
73      * Applies the patch. Typically this will be within the bounds of a new
74      * transaction.
75      *
76      * @return Returns the patch execution report
77      * @throws PatchException if the patch failed to be applied
78      */

79     public String JavaDoc apply() throws PatchException;
80 }
81
Popular Tags