KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > beans > config > VersionConfig


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.beans.config;
14
15 import info.magnolia.cms.util.FactoryUtil;
16
17
18 /**
19  * @author Sameer Charles
20  * $Id: VersionConfig.java 6945 2006-10-27 10:36:59Z scharles $
21  */

22 public class VersionConfig {
23
24     /**
25      * maximum index to keep
26      */

27     public static final String JavaDoc MAX_VERSION_INDEX = "maxVersionIndex";
28
29     /**
30      * is versioning is active (at application level, JCR is always configured to version if implemented)
31      */

32     public static final String JavaDoc ACTIVE = "active";
33
34     /**
35      * maximum number of version index
36      */

37     private static long maxVersions = 2; // default is 3 which could be overwritten through config
38

39     public VersionConfig() {
40         // do not instantiate
41
}
42
43     public static VersionConfig getInstance() {
44         return (VersionConfig) FactoryUtil.getSingleton(VersionConfig.class);
45     }
46
47     /**
48      * Initialize bean
49      */

50     public void init() {
51         load();
52     }
53
54     /**
55      * Its a fixed config bean
56      */

57     public void load() {
58         // nothing to do
59
}
60
61     /**
62      * Read config and reload bean
63      */

64     public void reload() {
65         load();
66     }
67
68     /**
69      * Checks active flag in version config
70      * @return true if versioning is active at application level
71      */

72     public boolean isActive() {
73         return true;
74     }
75
76     /**
77      * Get maximum number of versions allowed in version history
78      * @return max version index
79      */

80     public long getMaxVersionAllowed() {
81         return maxVersions;
82     }
83
84 }
85
Popular Tags