Source code: com/opencms/core/CmsStaticExportProperties.java
1 package com.opencms.core;
2 /*
3 * File : $Source: /usr/local/cvs/opencms/src/com/opencms/core/Attic/CmsStaticExportProperties.java,v $
4 * Date : $Date: 2002/10/30 10:13:21 $
5 * Version: $Revision: 1.2 $
6 *
7 * This library is part of OpenCms -
8 * the Open Source Content Mananagement System
9 *
10 * Copyright (C) 2001 The OpenCms Group
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 * For further information about OpenCms, please see the
23 * OpenCms Website: http://www.opencms.org
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 */
29
30 import java.util.*;
31
32 /**
33 * This class provides a special data structure to access the static
34 * export properties read from <code>opencms.properties</code>.
35 *
36 * @author Hanjo Riege
37 *
38 * @version $Revision: 1.2 $ $Date: 2002/10/30 10:13:21 $
39 */
40
41 public class CmsStaticExportProperties implements I_CmsConstants{
42
43 /**
44 * the link in the static export that link to pages that are exportet too
45 * are generated relative. This is only bugfree if the linkrules stay standard.
46 */
47 private static boolean c_exportRelativeLinks = false;
48
49 /**
50 * the vectors to store the three different rulesets needed for the link replacement.
51 * Each vector contains a ruleset. The elements are regular expressions (Strings) the
52 * way perl5 uses them.
53 */
54 private static String[] c_linkRulesExport = null;
55 private static String[] c_linkRulesOnline = null;
56 private static String[] c_linkRulesOffline = null;
57 private static String[] c_linkRulesExtern = null;
58
59 /**
60 * the start rule for the extern and the export rules
61 */
62 private static String c_linkRuleStart = null;
63
64 /**
65 * Is the static export enabled or diabled
66 */
67 private static boolean c_staticExportEnabled = false;
68
69 /**
70 * is export=true the default value for the resources property "export"
71 */
72 private static boolean c_exportDefaultTrue = true;
73
74 /**
75 * the value of the exportEnabled parameter.
76 */
77 private static String c_staticExportEnabledValue = "";
78
79 /**
80 * The path to where the export will go
81 */
82 private static String c_staticExportPath = null;
83
84 /**
85 * The startpoints for the static export.
86 */
87 private static Vector c_staticExportStart = null;
88
89 /**
90 * contains the four url prefixe for the lnikreplacement.
91 * That are the prefix for export, http, https and servername. The last
92 * two are used only wenn https is needed.
93 */
94 private static String[] c_staticUrlPrefix = new String[4];
95
96 /*****************************************************************
97 * Constuctor.
98 */
99 public CmsStaticExportProperties() {
100 }
101
102 /**
103 * Returns the exportpath for the static export.
104 */
105 public String getExportPath(){
106 return c_staticExportPath;
107 }
108
109 /**
110 * Returns the ruleset for link replacement.
111 * @param state. defines which set is needed.
112 * @return String[] the ruleset.
113 */
114 public static String[] getLinkRules(int state){
115
116 if(state == C_MODUS_ONLINE){
117 return c_linkRulesOnline;
118 }else if(state == C_MODUS_OFFLINE){
119 return c_linkRulesOffline;
120 }else if(state == C_MODUS_EXPORT){
121 return c_linkRulesExport;
122 }else if(state == C_MODUS_EXTERN){
123 return c_linkRulesExtern;
124 }
125 return null;
126 }
127
128 /**
129 * Returns a Vector (of Strings) with the names of the vfs resources (files
130 * and folders) where the export should start.
131 *
132 * @return Vector with resources for the export.
133 */
134 public Vector getStartPoints(){
135 return c_staticExportStart;
136 }
137
138 /**
139 * return the start rule used for export and extern mode.
140 */
141 public String getStartRule(){
142 return c_linkRuleStart;
143 }
144
145 /**
146 * Returns the value of the static export enable.
147 * (needed for the false_ssl feature)
148 */
149 public String getStaticExportEnabledValue(){
150 return c_staticExportEnabledValue;
151 }
152
153 /**
154 * Gets the prefix array for the linkreplacement
155 * @return String[4]
156 */
157 public String[] getUrlPrefixArray(){
158 return c_staticUrlPrefix;
159 }
160
161 /**
162 * returns true if the default value for the resource property "export"
163 * is true.
164 */
165 public boolean isExportDefault(){
166 return c_exportDefaultTrue;
167 }
168
169 /**
170 * Returns true if the static export is enabled
171 */
172 public boolean isStaticExportEnabled(){
173 return c_staticExportEnabled;
174 }
175
176 /**
177 * Returns true if the links in the static export should be relative.
178 */
179 public boolean relativLinksInExport(){
180 return c_exportRelativeLinks;
181 }
182
183 public void setExportDefaultValue(String value){
184 if("dynamic".equalsIgnoreCase(value)){
185 c_exportDefaultTrue = false;
186 }else{
187 c_exportDefaultTrue = true;
188 }
189 }
190 public void setExportPath(String path){
191 c_staticExportPath = path;
192 }
193 public void setExportRelativeLinks(boolean relLinks){
194 c_exportRelativeLinks = relLinks;
195 }
196 public void setLinkRulesExport(String[] rule){
197 c_linkRulesExport = rule;
198 }
199 public void setLinkRulesOnline(String[] rule){
200 c_linkRulesOnline = rule;
201 }
202 public void setLinkRulesOffline(String[] rule){
203 c_linkRulesOffline = rule;
204 }
205 public void setLinkRulesExtern(String[] rule){
206 c_linkRulesExtern = rule;
207 }
208 public void setStartPoints(Vector sp){
209 c_staticExportStart = sp;
210 }
211 public void setStartRule(String rule){
212 c_linkRuleStart = rule;
213 }
214 public void setStaticExportEnabled(boolean active){
215 c_staticExportEnabled = active;
216 }
217 public void setStaticExportEnabledValue(String value){
218 c_staticExportEnabledValue = value;
219 }
220 public void setUrlPrefixArray(String[] urls){
221 c_staticUrlPrefix = urls;
222 }
223
224 }