001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software GmbH & Co. KG, please see the 018 * company website: https://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: https://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.configuration; 029 030import org.opencms.db.CmsUserExportSettings; 031import org.opencms.importexport.CmsExtendedHtmlImportDefault; 032import org.opencms.importexport.CmsImportExportManager; 033import org.opencms.importexport.CmsImportExportManager.TimestampMode; 034import org.opencms.importexport.I_CmsImport; 035import org.opencms.importexport.I_CmsImportExportHandler; 036import org.opencms.main.CmsLog; 037import org.opencms.repository.CmsRepositoryFilter; 038import org.opencms.repository.CmsRepositoryManager; 039import org.opencms.repository.I_CmsRepository; 040import org.opencms.security.I_CmsPrincipal; 041import org.opencms.staticexport.A_CmsOnDemandStaticExportHandler; 042import org.opencms.staticexport.CmsSharedCacheConfiguration; 043import org.opencms.staticexport.CmsSharedCachePolicy; 044import org.opencms.staticexport.CmsStaticExportExportRule; 045import org.opencms.staticexport.CmsStaticExportManager; 046import org.opencms.staticexport.CmsStaticExportRfsRule; 047import org.opencms.staticexport.CmsStoredContentDeliveryConfiguration; 048import org.opencms.util.CmsResourceTranslator; 049import org.opencms.util.CmsStringUtil; 050 051import java.io.File; 052import java.util.Iterator; 053import java.util.List; 054import java.util.Map; 055import java.util.Map.Entry; 056import java.util.regex.Pattern; 057 058import javax.xml.parsers.ParserConfigurationException; 059 060import org.apache.commons.digester3.Digester; 061import org.apache.commons.digester3.NodeCreateRule; 062import org.apache.commons.logging.Log; 063 064import org.dom4j.Element; 065import org.w3c.dom.NodeList; 066 067/** 068 * Import / export master configuration class.<p> 069 * 070 * @since 6.0.0 071 */ 072public class CmsImportExportConfiguration extends A_CmsXmlConfiguration { 073 074 /** The name of the DTD for this configuration. */ 075 public static final String CONFIGURATION_DTD_NAME = "opencms-importexport.dtd"; 076 077 /** The name of the default XML file for this configuration. */ 078 public static final String DEFAULT_XML_FILE_NAME = "opencms-importexport.xml"; 079 080 /** The node name of the column node. */ 081 public static final String N_COLUMN = "column"; 082 083 /** The node name of the columns node. */ 084 public static final String N_COLUMNS = "columns"; 085 086 /** Node that indicates page conversion. */ 087 public static final String N_CONVERT = "convert"; 088 089 /** The node name of the export sub-configuration. */ 090 public static final String N_EXPORT = "export"; 091 092 /** The node name of the defaultexporttimestamps sub-configuration. */ 093 public static final String N_EXPORT_DEFAULTTIMESTAMPMODES = "defaulttimestampmodes"; 094 095 /** The node name of the resourcetype sub-configuration. */ 096 public static final String N_EXPORT_RESOURCETYPENAME = "resourcetypename"; 097 098 /** The node name of the timestamp sub-configuration. */ 099 public static final String N_EXPORT_TIMESTAMPMODE = "timestampmode"; 100 101 /** The main configuration node for the extended html import. */ 102 public static final String N_EXTHTMLIMPORT = "extendedhtmlimport"; 103 104 /** The node name of the html import destination node. */ 105 public static final String N_EXTHTMLIMPORT_DESTINATION = "destination"; 106 107 /** The node name of the html import download gallery node. */ 108 public static final String N_EXTHTMLIMPORT_DOWNLOAD = "download"; 109 110 /** The node name of the html import template node. */ 111 public static final String N_EXTHTMLIMPORT_ELEMENT = "element"; 112 113 /** The node name of the html import encoding node. */ 114 public static final String N_EXTHTMLIMPORT_ENCODING = "encoding"; 115 116 /** The node name of the html import image gallery node. */ 117 public static final String N_EXTHTMLIMPORT_EXTERNALLINK = "externallink"; 118 119 /** The node name of the html import galleries node. */ 120 public static final String N_EXTHTMLIMPORT_GALLERIES = "galleries"; 121 122 /** The node name of the html import image gallery node. */ 123 public static final String N_EXTHTMLIMPORT_IMAGE = "image"; 124 125 /** The node name of the html import input node. */ 126 public static final String N_EXTHTMLIMPORT_INPUT = "input"; 127 128 /** The node name of the html import overwritefiles node. */ 129 public static final String N_EXTHTMLIMPORT_KEEPBROKENLINKS = "keepbrokenlinks"; 130 131 /** The node name of the html import locale node. */ 132 public static final String N_EXTHTMLIMPORT_LOCALE = "locale"; 133 134 /** The node name of the html import overwritefiles node. */ 135 public static final String N_EXTHTMLIMPORT_OVERWRITE = "overwritefiles"; 136 137 /** The node name of the html import pattern node. */ 138 public static final String N_EXTHTMLIMPORT_PATTERN = "pattern"; 139 140 /** The node name of the html import end pattern node. */ 141 public static final String N_EXTHTMLIMPORT_PATTERN_END = "end"; 142 143 /** The node name of the html import start pattern node. */ 144 public static final String N_EXTHTMLIMPORT_PATTERN_START = "start"; 145 146 /** The node name of the html import settings node. */ 147 public static final String N_EXTHTMLIMPORT_SETTINGS = "settings"; 148 149 /** The node name of the html import template node. */ 150 public static final String N_EXTHTMLIMPORT_TEMPLATE = "template"; 151 152 /** filetranslations node name. */ 153 public static final String N_FILETRANSLATIONS = "filetranslations"; 154 155 /** The node name of the repository filter node. */ 156 public static final String N_FILTER = "filter"; 157 158 /** Node that contains a list of properties ignored during import. */ 159 public static final String N_IGNOREDPROPERTIES = "ignoredproperties"; 160 161 /** The import immutable resources node. */ 162 public static final String N_IMMUTABLES = "immutables"; 163 164 /** The node name of the import sub-configuration. */ 165 public static final String N_IMPORT = "import"; 166 167 /** The main configuration node name. */ 168 public static final String N_IMPORTEXPORT = "importexport"; 169 170 /** The node name of an individual import/export handler. */ 171 public static final String N_IMPORTEXPORTHANDLER = "importexporthandler"; 172 173 /** Master node for import/export handlers. */ 174 public static final String N_IMPORTEXPORTHANDLERS = "importexporthandlers"; 175 176 /** The node name of an individual import version class. */ 177 public static final String N_IMPORTVERSION = "importversion"; 178 179 /** Master node for import version class names. */ 180 public static final String N_IMPORTVERSIONS = "importversions"; 181 182 /** The node name of the static export handler node. */ 183 public static final String N_LINKSUBSTITUTION_HANDLER = "linksubstitutionhandler"; 184 185 /** Node the contains an optional URL of old web application. */ 186 public static final String N_OLDWEBAPPURL = "oldwebappurl"; 187 188 /** The import overwrite node name. */ 189 public static final String N_OVERWRITE = "overwrite"; 190 191 /** The node name of the repository params node. */ 192 public static final String N_PARAMS = "params"; 193 194 /** An individual principal translation node. */ 195 public static final String N_PRINCIPALTRANSLATION = "principaltranslation"; 196 197 /** The principal translation node. */ 198 public static final String N_PRINCIPALTRANSLATIONS = "principaltranslations"; 199 200 /** The node name of the column node. */ 201 public static final String N_PROTECTED_EXPORT = "protectedexport"; 202 203 /** The node name of the repository filter regex node. */ 204 public static final String N_REGEX = "regex"; 205 206 /** The node name of the repositories node. */ 207 public static final String N_REPOSITORIES = "repositories"; 208 209 /** The node name of the repository node. */ 210 public static final String N_REPOSITORY = "repository"; 211 212 /** The node name of the separator node. */ 213 public static final String N_SEPARATOR = "separator"; 214 215 /** The node name of the shared cache configuration. */ 216 public static final String N_SHAREDCACHE = "sharedcache"; 217 218 /** The node name of a shared cache policy. */ 219 public static final String N_SHAREDCACHE_CACHEPOLICY = "cachepolicy"; 220 221 /** The node name of the shared cache client maximum age. */ 222 public static final String N_SHAREDCACHE_CLIENTMAXAGE = "clientmaxage"; 223 224 /** The node name of the shared cache shared maximum age. */ 225 public static final String N_SHAREDCACHE_SHAREDMAXAGE = "sharedmaxage"; 226 227 /** The node name of the shared cache stale-if-error duration. */ 228 public static final String N_SHAREDCACHE_STALEIFERROR = "staleiferror"; 229 230 /** The main configuration node for static export name. */ 231 public static final String N_STATICEXPORT = "staticexport"; 232 233 /** The node name of the static export acceptcharset node. */ 234 public static final String N_STATICEXPORT_ACCEPTCHARSET = "acceptcharset"; 235 236 /** The node name of the static export acceptlanguage node. */ 237 public static final String N_STATICEXPORT_ACCEPTLANGUAGE = "acceptlanguage"; 238 239 /** The node name of the static export default node. */ 240 public static final String N_STATICEXPORT_DEFAULT = "defaultpropertyvalue"; 241 242 /** The node name of the static export defualtsuffix node. */ 243 public static final String N_STATICEXPORT_DEFAULTSUFFIXES = "defaultsuffixes"; 244 245 /** The node name of the static export rule description nodes. */ 246 public static final String N_STATICEXPORT_DESCRIPTION = "description"; 247 248 /** The node name of the static export export-rule export node. */ 249 public static final String N_STATICEXPORT_EXPORT = "export-resources"; 250 251 /** The node name of the static export exportbackups node. */ 252 public static final String N_STATICEXPORT_EXPORTBACKUPS = "exportbackups"; 253 254 /** The node name of the static export exportheaders node. */ 255 public static final String N_STATICEXPORT_EXPORTHEADERS = "exportheaders"; 256 257 /** The node name of the static export exportpath node. */ 258 public static final String N_STATICEXPORT_EXPORTPATH = "exportpath"; 259 260 /** The node name of the static export export-rule node. */ 261 public static final String N_STATICEXPORT_EXPORTRULE = "export-rule"; 262 263 /** The node name of the static export export-rules node. */ 264 public static final String N_STATICEXPORT_EXPORTRULES = "export-rules"; 265 266 /** The node name of the static export exporturl node. */ 267 public static final String N_STATICEXPORT_EXPORTURL = "exporturl"; 268 269 /** The node name of the static export exportworkpath node. */ 270 public static final String N_STATICEXPORT_EXPORTWORKPATH = "exportworkpath"; 271 272 /** The node name of the static export handler node. */ 273 public static final String N_STATICEXPORT_HANDLER = "staticexporthandler"; 274 275 /** The node name of the static export header node. */ 276 public static final String N_STATICEXPORT_HEADER = "header"; 277 278 /** The node name of the static export export-rule modified node. */ 279 public static final String N_STATICEXPORT_MODIFIED = "modified-resources"; 280 281 /** The node name of the static export rule name nodes. */ 282 public static final String N_STATICEXPORT_NAME = "name"; 283 284 /** The node name of the static export plainoptimization node. */ 285 public static final String N_STATICEXPORT_PLAINOPTIMIZATION = "plainoptimization"; 286 287 /** The node name of the static export regex node. */ 288 public static final String N_STATICEXPORT_REGEX = "regex"; 289 290 /** The node name of the static export related-system-res node. */ 291 public static final String N_STATICEXPORT_RELATED_SYSTEM_RES = "related-system-res"; 292 293 /** The node name of the static export relativelinks node. */ 294 public static final String N_STATICEXPORT_RELATIVELINKS = "userelativelinks"; 295 296 /** The node name of the static export remoteaddr node. */ 297 public static final String N_STATICEXPORT_REMOTEADDR = "remoteaddr"; 298 299 /** The node name of the static export rendersettings node. */ 300 public static final String N_STATICEXPORT_RENDERSETTINGS = "rendersettings"; 301 302 /** The node name of the static export requestheaders node. */ 303 public static final String N_STATICEXPORT_REQUESTHEADERS = "requestheaders"; 304 305 /** The node name of the static export resourcestorender node. */ 306 public static final String N_STATICEXPORT_RESOURCESTORENDER = "resourcestorender"; 307 308 /** The node name of the static export rfx-prefix node. */ 309 public static final String N_STATICEXPORT_RFS_PREFIX = "rfs-prefix"; 310 311 /** The node name of the static export rfx-rule node. */ 312 public static final String N_STATICEXPORT_RFS_RULE = "rfs-rule"; 313 314 /** The node name of the static export rfx-rules node. */ 315 public static final String N_STATICEXPORT_RFS_RULES = "rfs-rules"; 316 317 /** The node name of the static export rfx-rule source node. */ 318 public static final String N_STATICEXPORT_SOURCE = "source"; 319 320 /** The node name of the static export suffix node. */ 321 public static final String N_STATICEXPORT_SUFFIX = "suffix"; 322 323 /** The node name of the static export testresource node. */ 324 public static final String N_STATICEXPORT_TESTRESOURCE = "testresource"; 325 326 /** The node name of the static export export-rule export uri node. */ 327 public static final String N_STATICEXPORT_URI = "uri"; 328 329 /** The node name of the static export vfx-prefix node. */ 330 public static final String N_STATICEXPORT_VFS_PREFIX = "vfs-prefix"; 331 332 /** The node name of the stored content delivery configuration. */ 333 public static final String N_STOREDCONTENTDELIVERY = "storedcontentdelivery"; 334 335 /** The node name of the stored content delivery enabled suffixes list. */ 336 public static final String N_STOREDCONTENTDELIVERY_ENABLEDSUFFIXES = "enabledsuffixes"; 337 338 /** The temporary export point path node. */ 339 public static final String N_TEMP_EXPORTPONT_PATH = "temp-exportpoint-path"; 340 341 /** translation node name. */ 342 public static final String N_TRANSLATION = "translation"; 343 344 /** The node name of the user csv export node. */ 345 public static final String N_USERCSVEXPORT = "usercsvexport"; 346 347 /** Log instance for this class. */ 348 private static final Log LOG = CmsLog.getLog(CmsImportExportConfiguration.class); 349 350 /** The configured import/export manager. */ 351 private CmsImportExportManager m_importExportManager; 352 353 /** The configured repository manager. */ 354 private CmsRepositoryManager m_repositoryManager; 355 356 /** The shared cache configuration. */ 357 private CmsSharedCacheConfiguration m_sharedCacheConfiguration = new CmsSharedCacheConfiguration(); 358 359 /** The configured static export manager. */ 360 private CmsStaticExportManager m_staticExportManager; 361 362 /** The stored content delivery configuration. */ 363 private CmsStoredContentDeliveryConfiguration m_storedContentDeliveryConfiguration = new CmsStoredContentDeliveryConfiguration(); 364 365 /** 366 * Adds an protected export point.<p> 367 * 368 * @param uri the source URI 369 * @param destination the export destination 370 */ 371 public void addProtectedExportPoint(String uri, String destination) { 372 373 m_staticExportManager.addProtectedExportPoint(uri, destination); 374 } 375 376 /** 377 * @see org.opencms.configuration.I_CmsXmlConfiguration#addXmlDigesterRules(org.apache.commons.digester3.Digester) 378 */ 379 public void addXmlDigesterRules(Digester digester) { 380 381 // add finish rule 382 digester.addCallMethod("*/" + N_IMPORTEXPORT, "initializeFinished"); 383 384 // creation of the import/export manager 385 digester.addObjectCreate("*/" + N_IMPORTEXPORT, CmsImportExportManager.class); 386 // import/export manager finished 387 digester.addSetNext("*/" + N_IMPORTEXPORT, "setImportExportManager"); 388 389 // add rules for import/export handlers 390 digester.addObjectCreate( 391 "*/" + N_IMPORTEXPORT + "/" + N_IMPORTEXPORTHANDLERS + "/" + N_IMPORTEXPORTHANDLER, 392 CmsConfigurationException.class.getName(), 393 A_CLASS); 394 digester.addSetNext( 395 "*/" + N_IMPORTEXPORT + "/" + N_IMPORTEXPORTHANDLERS + "/" + N_IMPORTEXPORTHANDLER, 396 "addImportExportHandler"); 397 398 // overwrite rule 399 digester.addCallMethod( 400 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_OVERWRITE, 401 "setOverwriteCollidingResources", 402 0); 403 404 // convert rule 405 digester.addCallMethod("*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_CONVERT, "setConvertToXmlPage", 0); 406 407 // old webapp rule 408 digester.addCallMethod("*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_OLDWEBAPPURL, "setOldWebAppUrl", 0); 409 410 // add rules for the import versions 411 digester.addObjectCreate( 412 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_IMPORTVERSIONS + "/" + N_IMPORTVERSION, 413 CmsConfigurationException.class.getName(), 414 A_CLASS); 415 digester.addSetNext( 416 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_IMPORTVERSIONS + "/" + N_IMPORTVERSION, 417 "addImportVersionClass"); 418 419 // add rules for the import immutables 420 digester.addCallMethod( 421 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_IMMUTABLES + "/" + N_RESOURCE, 422 "addImmutableResource", 423 1); 424 digester.addCallParam("*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_IMMUTABLES + "/" + N_RESOURCE, 0, A_URI); 425 426 // add rules for the import principal translations 427 digester.addCallMethod( 428 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_PRINCIPALTRANSLATIONS + "/" + N_PRINCIPALTRANSLATION, 429 "addImportPrincipalTranslation", 430 3); 431 digester.addCallParam( 432 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_PRINCIPALTRANSLATIONS + "/" + N_PRINCIPALTRANSLATION, 433 0, 434 A_TYPE); 435 digester.addCallParam( 436 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_PRINCIPALTRANSLATIONS + "/" + N_PRINCIPALTRANSLATION, 437 1, 438 A_FROM); 439 digester.addCallParam( 440 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_PRINCIPALTRANSLATIONS + "/" + N_PRINCIPALTRANSLATION, 441 2, 442 A_TO); 443 444 // add rules for the ignored properties 445 digester.addCallMethod( 446 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_IGNOREDPROPERTIES + "/" + N_PROPERTY, 447 "addIgnoredProperty", 448 1); 449 digester.addCallParam( 450 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_IGNOREDPROPERTIES + "/" + N_PROPERTY, 451 0, 452 A_NAME); 453 454 // add rules for export settings 455 digester.addCallMethod( 456 "*/" 457 + N_IMPORTEXPORT 458 + "/" 459 + N_EXPORT 460 + "/" 461 + N_EXPORT_DEFAULTTIMESTAMPMODES 462 + "/" 463 + N_EXPORT_TIMESTAMPMODE, 464 "addDefaultTimestampMode", 465 1); 466 467 digester.addCallParam( 468 "*/" 469 + N_IMPORTEXPORT 470 + "/" 471 + N_EXPORT 472 + "/" 473 + N_EXPORT_DEFAULTTIMESTAMPMODES 474 + "/" 475 + N_EXPORT_TIMESTAMPMODE, 476 0, 477 A_MODE); 478 479 digester.addCallMethod( 480 "*/" 481 + N_IMPORTEXPORT 482 + "/" 483 + N_EXPORT 484 + "/" 485 + N_EXPORT_DEFAULTTIMESTAMPMODES 486 + "/" 487 + N_EXPORT_TIMESTAMPMODE 488 + "/" 489 + N_EXPORT_RESOURCETYPENAME, 490 "addResourceTypeForDefaultTimestampMode", 491 1); 492 493 digester.addCallParam( 494 "*/" 495 + N_IMPORTEXPORT 496 + "/" 497 + N_EXPORT 498 + "/" 499 + N_EXPORT_DEFAULTTIMESTAMPMODES 500 + "/" 501 + N_EXPORT_TIMESTAMPMODE 502 + "/" 503 + N_EXPORT_RESOURCETYPENAME, 504 0); 505 506 digester.addCallMethod("*/" + N_IMPORTEXPORT + "/" + N_TEMP_EXPORTPONT_PATH, "addTempExportpointPath", 1); 507 digester.addCallParam("*/" + N_IMPORTEXPORT + "/" + N_TEMP_EXPORTPONT_PATH, 0); 508 509 // creation of the static export manager 510 digester.addObjectCreate("*/" + N_STATICEXPORT, CmsStaticExportManager.class); 511 // static export manager finished 512 digester.addSetNext("*/" + N_STATICEXPORT, "setStaticExportManager"); 513 // export enabled role 514 digester.addCallMethod("*/" + N_STATICEXPORT, "setExportEnabled", 1); 515 digester.addCallParam("*/" + N_STATICEXPORT, 0, A_ENABLED); 516 // export handler rule 517 digester.addCallMethod("*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_HANDLER, "setHandler", 0); 518 // link substitution handler rule 519 digester.addCallMethod( 520 "*/" + N_STATICEXPORT + "/" + N_LINKSUBSTITUTION_HANDLER, 521 "setLinkSubstitutionHandler", 522 0); 523 // exportpath rule 524 digester.addCallMethod("*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_EXPORTPATH, "setExportPath", 0); 525 // exportworkpath rule 526 digester.addCallMethod("*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_EXPORTWORKPATH, "setExportWorkPath", 0); 527 // exportbackups rule 528 digester.addCallMethod("*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_EXPORTBACKUPS, "setExportBackups", 0); 529 // default property rule 530 digester.addCallMethod("*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_DEFAULT, "setDefault", 0); 531 // export suffix rule 532 digester.addCallMethod( 533 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_DEFAULTSUFFIXES + "/" + N_STATICEXPORT_SUFFIX, 534 "setExportSuffix", 535 1); 536 digester.addCallParam( 537 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_DEFAULTSUFFIXES + "/" + N_STATICEXPORT_SUFFIX, 538 0, 539 A_KEY); 540 // header rule 541 digester.addCallMethod( 542 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_EXPORTHEADERS + "/" + N_STATICEXPORT_HEADER, 543 "setExportHeader", 544 0); 545 // accept-language rule 546 digester.addCallMethod( 547 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_REQUESTHEADERS + "/" + N_STATICEXPORT_ACCEPTLANGUAGE, 548 "setAcceptLanguageHeader", 549 0); 550 // accept-charset rule 551 digester.addCallMethod( 552 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_REQUESTHEADERS + "/" + N_STATICEXPORT_ACCEPTCHARSET, 553 "setAcceptCharsetHeader", 554 0); 555 // accept-charset rule 556 digester.addCallMethod( 557 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_REQUESTHEADERS + "/" + N_STATICEXPORT_REMOTEADDR, 558 "setRemoteAddr", 559 0); 560 // rfs-prefix rule 561 digester.addCallMethod( 562 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_RENDERSETTINGS + "/" + N_STATICEXPORT_RFS_PREFIX, 563 "setRfsPrefix", 564 0); 565 // vfs-prefix rule 566 digester.addCallMethod( 567 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_RENDERSETTINGS + "/" + N_STATICEXPORT_VFS_PREFIX, 568 "setVfsPrefix", 569 0); 570 // relative links rule 571 digester.addCallMethod( 572 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_RENDERSETTINGS + "/" + N_STATICEXPORT_RELATIVELINKS, 573 "setRelativeLinks", 574 0); 575 // exporturl rule 576 digester.addCallMethod( 577 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_RENDERSETTINGS + "/" + N_STATICEXPORT_EXPORTURL, 578 "setExportUrl", 579 0); 580 // plain export optimization rule 581 digester.addCallMethod( 582 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_RENDERSETTINGS + "/" + N_STATICEXPORT_PLAINOPTIMIZATION, 583 "setPlainExportOptimization", 584 0); 585 // test resource rule 586 digester.addCallMethod( 587 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_RENDERSETTINGS + "/" + N_STATICEXPORT_TESTRESOURCE, 588 "setTestResource", 589 1); 590 digester.addCallParam( 591 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_RENDERSETTINGS + "/" + N_STATICEXPORT_TESTRESOURCE, 592 0, 593 A_URI); 594 // resources to export rule 595 digester.addCallMethod( 596 "*/" 597 + N_STATICEXPORT 598 + "/" 599 + N_STATICEXPORT_RENDERSETTINGS 600 + "/" 601 + N_STATICEXPORT_RESOURCESTORENDER 602 + "/" 603 + N_STATICEXPORT_REGEX, 604 "setExportFolderPattern", 605 0); 606 607 // export-rules configuration 608 String exportRulePath = "*/" 609 + N_STATICEXPORT 610 + "/" 611 + N_STATICEXPORT_RENDERSETTINGS 612 + "/" 613 + N_STATICEXPORT_RESOURCESTORENDER 614 + "/" 615 + N_STATICEXPORT_EXPORTRULES 616 + "/" 617 + N_STATICEXPORT_EXPORTRULE; 618 digester.addCallMethod(exportRulePath, "addExportRule", 2); 619 digester.addCallParam(exportRulePath + "/" + N_STATICEXPORT_NAME, 0); 620 digester.addCallParam(exportRulePath + "/" + N_STATICEXPORT_DESCRIPTION, 1); 621 digester.addCallMethod( 622 exportRulePath + "/" + N_STATICEXPORT_MODIFIED + "/" + N_STATICEXPORT_REGEX, 623 "addExportRuleRegex", 624 1); 625 digester.addCallParam(exportRulePath + "/" + N_STATICEXPORT_MODIFIED + "/" + N_STATICEXPORT_REGEX, 0); 626 digester.addCallMethod( 627 exportRulePath + "/" + N_STATICEXPORT_EXPORT + "/" + N_STATICEXPORT_URI, 628 "addExportRuleUri", 629 1); 630 digester.addCallParam(exportRulePath + "/" + N_STATICEXPORT_EXPORT + "/" + N_STATICEXPORT_URI, 0); 631 632 // rfs-rules configuration 633 String rfsRulePath = "*/" 634 + N_STATICEXPORT 635 + "/" 636 + N_STATICEXPORT_RENDERSETTINGS 637 + "/" 638 + N_STATICEXPORT_RFS_RULES 639 + "/" 640 + N_STATICEXPORT_RFS_RULE; 641 digester.addCallMethod(rfsRulePath, "addRfsRule", 8); 642 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_NAME, 0); 643 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_DESCRIPTION, 1); 644 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_SOURCE, 2); 645 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_RFS_PREFIX, 3); 646 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_EXPORTPATH, 4); 647 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_EXPORTWORKPATH, 5); 648 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_EXPORTBACKUPS, 6); 649 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_RELATIVELINKS, 7); 650 // rfs-rule related system resources 651 digester.addCallMethod( 652 rfsRulePath + "/" + N_STATICEXPORT_RELATED_SYSTEM_RES + "/" + N_STATICEXPORT_REGEX, 653 "addRfsRuleSystemRes", 654 1); 655 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_RELATED_SYSTEM_RES + "/" + N_STATICEXPORT_REGEX, 0); 656 657 // creation of the stored content delivery configuration 658 digester.addObjectCreate("*/" + N_STOREDCONTENTDELIVERY, CmsStoredContentDeliveryConfiguration.class); 659 digester.addSetNext("*/" + N_STOREDCONTENTDELIVERY, "setStoredContentDeliveryConfiguration"); 660 digester.addCallMethod("*/" + N_STOREDCONTENTDELIVERY, "setEnabled", 1); 661 digester.addCallParam("*/" + N_STOREDCONTENTDELIVERY, 0, A_ENABLED); 662 // stored content delivery suffix rule 663 digester.addCallMethod( 664 "*/" 665 + N_STOREDCONTENTDELIVERY 666 + "/" 667 + N_STOREDCONTENTDELIVERY_ENABLEDSUFFIXES 668 + "/" 669 + N_STATICEXPORT_SUFFIX, 670 "addEnabledSuffix", 671 1); 672 digester.addCallParam( 673 "*/" 674 + N_STOREDCONTENTDELIVERY 675 + "/" 676 + N_STOREDCONTENTDELIVERY_ENABLEDSUFFIXES 677 + "/" 678 + N_STATICEXPORT_SUFFIX, 679 0, 680 A_KEY); 681 682 // creation of the shared cache configuration 683 digester.addObjectCreate("*/" + N_SHAREDCACHE, CmsSharedCacheConfiguration.class); 684 digester.addSetNext("*/" + N_SHAREDCACHE, "setSharedCacheConfiguration"); 685 digester.addCallMethod("*/" + N_SHAREDCACHE, "setEnabled", 1); 686 digester.addCallParam("*/" + N_SHAREDCACHE, 0, A_ENABLED); 687 // shared cache policy rules 688 String sharedCachePolicyPath = "*/" + N_SHAREDCACHE + "/" + N_SHAREDCACHE_CACHEPOLICY; 689 digester.addObjectCreate(sharedCachePolicyPath, CmsSharedCachePolicy.class); 690 digester.addSetNext(sharedCachePolicyPath, "addCachePolicy"); 691 digester.addCallMethod(sharedCachePolicyPath, "setContentType", 1); 692 digester.addCallParam(sharedCachePolicyPath, 0, "contenttype"); 693 digester.addCallMethod(sharedCachePolicyPath + "/" + N_SHAREDCACHE_CLIENTMAXAGE, "setClientMaxAge", 0); 694 digester.addCallMethod(sharedCachePolicyPath + "/" + N_SHAREDCACHE_SHAREDMAXAGE, "setSharedMaxAge", 0); 695 digester.addCallMethod(sharedCachePolicyPath + "/" + N_SHAREDCACHE_STALEIFERROR, "setStaleIfError", 0); 696 697 // adds protected export rules 698 digester.addCallMethod( 699 "*/" + N_PROTECTED_EXPORT + "/" + N_STATICEXPORT_EXPORTPATH, 700 "setProtectedExportPath", 701 1); 702 digester.addCallParam("*/" + N_PROTECTED_EXPORT + "/" + N_STATICEXPORT_EXPORTPATH, 0); 703 // add rules for the protected export points 704 digester.addCallMethod( 705 "*/" 706 + N_PROTECTED_EXPORT 707 + "/" 708 + I_CmsXmlConfiguration.N_EXPORTPOINTS 709 + "/" 710 + I_CmsXmlConfiguration.N_EXPORTPOINT, 711 "addProtectedExportPoint", 712 2); 713 digester.addCallParam( 714 "*/" 715 + N_PROTECTED_EXPORT 716 + "/" 717 + I_CmsXmlConfiguration.N_EXPORTPOINTS 718 + "/" 719 + I_CmsXmlConfiguration.N_EXPORTPOINT, 720 0, 721 I_CmsXmlConfiguration.A_URI); 722 digester.addCallParam( 723 "*/" 724 + N_PROTECTED_EXPORT 725 + "/" 726 + I_CmsXmlConfiguration.N_EXPORTPOINTS 727 + "/" 728 + I_CmsXmlConfiguration.N_EXPORTPOINT, 729 1, 730 I_CmsXmlConfiguration.A_DESTINATION); 731 732 // add rules for the user data export 733 digester.addObjectCreate("*/" + N_USERCSVEXPORT, CmsUserExportSettings.class); 734 digester.addCallMethod("*/" + N_USERCSVEXPORT + "/" + N_SEPARATOR, "setSeparator", 0); 735 digester.addCallMethod("*/" + N_USERCSVEXPORT + "/" + N_COLUMNS + "/" + N_COLUMN, "addColumn", 0); 736 digester.addSetNext("*/" + N_USERCSVEXPORT, "setUserExportSettings"); 737 738 // creation of the static repository manager 739 digester.addObjectCreate("*/" + N_REPOSITORIES, CmsRepositoryManager.class); 740 digester.addCallMethod("*/" + N_REPOSITORIES, I_CmsConfigurationParameterHandler.INIT_CONFIGURATION_METHOD); 741 digester.addSetNext("*/" + N_REPOSITORIES, "setRepositoryManager"); 742 743 // repository 744 digester.addObjectCreate( 745 "*/" + N_REPOSITORIES + "/" + N_REPOSITORY, 746 CmsConfigurationException.class.getName(), 747 A_CLASS); 748 749 try { 750 digester.addRule( 751 "*/" + N_REPOSITORIES + "/" + N_REPOSITORY + "/" + N_FILETRANSLATIONS, 752 new NodeCreateRule() { 753 754 @Override 755 public void end(String namespace, String name) throws Exception { 756 757 org.w3c.dom.Element elem = (org.w3c.dom.Element)digester.pop(); 758 boolean enabled = Boolean.parseBoolean(elem.getAttribute(A_ENABLED)); 759 NodeList translationElements = elem.getElementsByTagName(N_TRANSLATION); 760 String[] translationStrings = new String[translationElements.getLength()]; 761 for (int i = 0; i < translationElements.getLength(); i++) { 762 org.w3c.dom.Element translationElem = (org.w3c.dom.Element)translationElements.item(i); 763 translationStrings[i] = translationElem.getTextContent(); 764 } 765 CmsResourceTranslator translator = new CmsResourceTranslator(translationStrings, true); 766 I_CmsRepository repo = (I_CmsRepository)(digester.peek()); 767 repo.setTranslation(translator, enabled); 768 } 769 }); 770 } catch (ParserConfigurationException e) { 771 LOG.error(e.getLocalizedMessage(), e); 772 } 773 774 // repository name 775 digester.addCallMethod("*/" + N_REPOSITORIES + "/" + N_REPOSITORY, "setName", 1); 776 digester.addCallParam("*/" + N_REPOSITORIES + "/" + N_REPOSITORY, 0, A_NAME); 777 778 // repository params 779 digester.addCallMethod( 780 "*/" + N_REPOSITORIES + "/" + N_REPOSITORY + "/" + N_PARAMS + "/" + N_PARAM, 781 I_CmsConfigurationParameterHandler.ADD_PARAMETER_METHOD, 782 2); 783 digester.addCallParam( 784 "*/" + N_REPOSITORIES + "/" + N_REPOSITORY + "/" + N_PARAMS + "/" + N_PARAM, 785 0, 786 I_CmsXmlConfiguration.A_NAME); 787 digester.addCallParam("*/" + N_REPOSITORIES + "/" + N_REPOSITORY + "/" + N_PARAMS + "/" + N_PARAM, 1); 788 789 // repository filter 790 digester.addObjectCreate( 791 "*/" + N_REPOSITORIES + "/" + N_REPOSITORY + "/" + N_FILTER, 792 CmsRepositoryFilter.class); 793 794 // repository filter type 795 digester.addCallMethod("*/" + N_REPOSITORIES + "/" + N_REPOSITORY + "/" + N_FILTER, "setType", 1); 796 digester.addCallParam("*/" + N_REPOSITORIES + "/" + N_REPOSITORY + "/" + N_FILTER, 0, A_TYPE); 797 798 // repository filter rules 799 digester.addCallMethod( 800 "*/" + N_REPOSITORIES + "/" + N_REPOSITORY + "/" + N_FILTER + "/" + N_REGEX, 801 "addFilterRule", 802 1); 803 digester.addCallParam("*/" + N_REPOSITORIES + "/" + N_REPOSITORY + "/" + N_FILTER + "/" + N_REGEX, 0); 804 805 digester.addSetNext("*/" + N_REPOSITORIES + "/" + N_REPOSITORY + "/" + N_FILTER, "setFilter"); 806 807 digester.addSetNext("*/" + N_REPOSITORIES + "/" + N_REPOSITORY, "addRepositoryClass"); 808 809 // create at least a repository manager though no repositories are configured 810 if (m_repositoryManager == null) { 811 m_repositoryManager = new CmsRepositoryManager(false); 812 } 813 // creation of the extended HTML importer 814 digester.addObjectCreate("*/" + N_EXTHTMLIMPORT, CmsExtendedHtmlImportDefault.class); 815 // extended HTML importer finished 816 digester.addSetNext("*/" + N_EXTHTMLIMPORT, "setExtendedHtmlImportManager"); 817 digester.addCallMethod("*/" + N_EXTHTMLIMPORT + "/" + N_EXTHTMLIMPORT_DESTINATION, "setDestinationDir", 0); 818 digester.addCallMethod("*/" + N_EXTHTMLIMPORT + "/" + N_EXTHTMLIMPORT_INPUT, "setInputDir", 0); 819 digester.addCallMethod( 820 "*/" + N_EXTHTMLIMPORT + "/" + N_EXTHTMLIMPORT_GALLERIES + "/" + N_EXTHTMLIMPORT_DOWNLOAD, 821 "setDownloadGallery", 822 0); 823 digester.addCallMethod( 824 "*/" + N_EXTHTMLIMPORT + "/" + N_EXTHTMLIMPORT_GALLERIES + "/" + N_EXTHTMLIMPORT_IMAGE, 825 "setImageGallery", 826 0); 827 digester.addCallMethod( 828 "*/" + N_EXTHTMLIMPORT + "/" + N_EXTHTMLIMPORT_GALLERIES + "/" + N_EXTHTMLIMPORT_EXTERNALLINK, 829 "setLinkGallery", 830 0); 831 digester.addCallMethod( 832 "*/" + N_EXTHTMLIMPORT + "/" + N_EXTHTMLIMPORT_SETTINGS + "/" + N_EXTHTMLIMPORT_TEMPLATE, 833 "setTemplate", 834 0); 835 digester.addCallMethod( 836 "*/" + N_EXTHTMLIMPORT + "/" + N_EXTHTMLIMPORT_SETTINGS + "/" + N_EXTHTMLIMPORT_ELEMENT, 837 "setElement", 838 0); 839 digester.addCallMethod( 840 "*/" + N_EXTHTMLIMPORT + "/" + N_EXTHTMLIMPORT_SETTINGS + "/" + N_EXTHTMLIMPORT_LOCALE, 841 "setLocale", 842 0); 843 digester.addCallMethod( 844 "*/" + N_EXTHTMLIMPORT + "/" + N_EXTHTMLIMPORT_SETTINGS + "/" + N_EXTHTMLIMPORT_ENCODING, 845 "setEncoding", 846 0); 847 digester.addCallMethod( 848 "*/" 849 + N_EXTHTMLIMPORT 850 + "/" 851 + N_EXTHTMLIMPORT_SETTINGS 852 + "/" 853 + N_EXTHTMLIMPORT_PATTERN 854 + "/" 855 + N_EXTHTMLIMPORT_PATTERN_START, 856 "setStartPattern", 857 0); 858 digester.addCallMethod( 859 "*/" 860 + N_EXTHTMLIMPORT 861 + "/" 862 + N_EXTHTMLIMPORT_SETTINGS 863 + "/" 864 + N_EXTHTMLIMPORT_PATTERN 865 + "/" 866 + N_EXTHTMLIMPORT_PATTERN_END, 867 "setEndPattern", 868 0); 869 digester.addCallMethod( 870 "*/" + N_EXTHTMLIMPORT + "/" + N_EXTHTMLIMPORT_SETTINGS + "/" + N_EXTHTMLIMPORT_OVERWRITE, 871 "setOverwrite", 872 0); 873 digester.addCallMethod( 874 "*/" + N_EXTHTMLIMPORT + "/" + N_EXTHTMLIMPORT_SETTINGS + "/" + N_EXTHTMLIMPORT_KEEPBROKENLINKS, 875 "setKeepBrokenLinks", 876 0); 877 } 878 879 /** 880 * @see org.opencms.configuration.I_CmsXmlConfiguration#generateXml(org.dom4j.Element) 881 */ 882 public Element generateXml(Element parent) { 883 884 // generate import/export node and subnodes 885 Element importexportElement = parent.addElement(N_IMPORTEXPORT); 886 887 Element resourceloadersElement = importexportElement.addElement(N_IMPORTEXPORTHANDLERS); 888 List<I_CmsImportExportHandler> handlers = m_importExportManager.getImportExportHandlers(); 889 Iterator<I_CmsImportExportHandler> handlerIt = handlers.iterator(); 890 while (handlerIt.hasNext()) { 891 I_CmsImportExportHandler handler = handlerIt.next(); 892 // add the handler node 893 Element loaderNode = resourceloadersElement.addElement(N_IMPORTEXPORTHANDLER); 894 loaderNode.addAttribute(A_CLASS, handler.getClass().getName()); 895 } 896 897 Element importElement = importexportElement.addElement(N_IMPORT); 898 899 // <overwrite> node 900 importElement.addElement(N_OVERWRITE).setText( 901 String.valueOf(m_importExportManager.overwriteCollidingResources())); 902 903 // <convert> node 904 importElement.addElement(N_CONVERT).setText(String.valueOf(m_importExportManager.convertToXmlPage())); 905 906 // <oldwebappurl> node 907 if (m_importExportManager.getOldWebAppUrl() != null) { 908 importElement.addElement(N_OLDWEBAPPURL).setText(m_importExportManager.getOldWebAppUrl()); 909 } 910 911 // <importversions> node 912 Element resourcetypesElement = importElement.addElement(N_IMPORTVERSIONS); 913 Iterator<I_CmsImport> importVersions = m_importExportManager.getImportVersionClasses().iterator(); 914 while (importVersions.hasNext()) { 915 resourcetypesElement.addElement(N_IMPORTVERSION).addAttribute( 916 A_CLASS, 917 importVersions.next().getClass().getName()); 918 } 919 920 // <immutables> node 921 Element immutablesElement = importElement.addElement(N_IMMUTABLES); 922 Iterator<String> immutables = m_importExportManager.getImmutableResources().iterator(); 923 while (immutables.hasNext()) { 924 String uri = immutables.next(); 925 immutablesElement.addElement(N_RESOURCE).addAttribute(A_URI, uri); 926 } 927 928 // <principaltranslations> node 929 Element principalsElement = importElement.addElement(N_PRINCIPALTRANSLATIONS); 930 Iterator<String> userTranslationKeys = m_importExportManager.getImportUserTranslations().keySet().iterator(); 931 while (userTranslationKeys.hasNext()) { 932 String from = userTranslationKeys.next(); 933 String to = m_importExportManager.getImportUserTranslations().get(from); 934 principalsElement.addElement(N_PRINCIPALTRANSLATION).addAttribute( 935 A_TYPE, 936 I_CmsPrincipal.PRINCIPAL_USER).addAttribute(A_FROM, from).addAttribute(A_TO, to); 937 } 938 Iterator<String> groupTranslationKeys = m_importExportManager.getImportGroupTranslations().keySet().iterator(); 939 while (groupTranslationKeys.hasNext()) { 940 String from = groupTranslationKeys.next(); 941 String to = m_importExportManager.getImportGroupTranslations().get(from); 942 principalsElement.addElement(N_PRINCIPALTRANSLATION).addAttribute( 943 A_TYPE, 944 I_CmsPrincipal.PRINCIPAL_GROUP).addAttribute(A_FROM, from).addAttribute(A_TO, to); 945 } 946 947 // <ignoredproperties> node 948 Element propertiesElement = importElement.addElement(N_IGNOREDPROPERTIES); 949 Iterator<String> ignoredProperties = m_importExportManager.getIgnoredProperties().iterator(); 950 while (ignoredProperties.hasNext()) { 951 String property = ignoredProperties.next(); 952 propertiesElement.addElement(N_PROPERTY).addAttribute(A_NAME, property); 953 } 954 955 // <export> node 956 Element exportElement = importexportElement.addElement(N_EXPORT); 957 Map<TimestampMode, List<String>> defaultTimestampModes = m_importExportManager.getDefaultTimestampModes(); 958 if (!defaultTimestampModes.isEmpty()) { 959 960 // <defaulttimestampmodes> 961 Element defaultTimestampModesElement = exportElement.addElement(N_EXPORT_DEFAULTTIMESTAMPMODES); 962 for (TimestampMode mode : defaultTimestampModes.keySet()) { 963 964 // <timestampmode> 965 Element timestampModeElement = defaultTimestampModesElement.addElement(N_EXPORT_TIMESTAMPMODE); 966 timestampModeElement.addAttribute(A_MODE, mode.toString().toLowerCase()); 967 for (String resourcetypeName : defaultTimestampModes.get(mode)) { 968 969 // <resourcetypename> 970 Element resourcetypeElement = timestampModeElement.addElement(N_EXPORT_RESOURCETYPENAME); 971 resourcetypeElement.addText(resourcetypeName); 972 } 973 } 974 } 975 976 List<String> tempExportpointPaths = m_importExportManager.getTempExportPointPaths(); 977 for (String path : tempExportpointPaths) { 978 importexportElement.addElement(N_TEMP_EXPORTPONT_PATH).addText(path); 979 } 980 981 // <staticexport> node 982 Element staticexportElement = parent.addElement(N_STATICEXPORT); 983 staticexportElement.addAttribute(A_ENABLED, m_staticExportManager.getExportEnabled()); 984 985 // <staticexporthandler> node 986 staticexportElement.addElement(N_STATICEXPORT_HANDLER).addText( 987 m_staticExportManager.getHandler().getClass().getName()); 988 989 // <linksubstitutionhandler> node 990 staticexportElement.addElement(N_LINKSUBSTITUTION_HANDLER).addText( 991 m_staticExportManager.getLinkSubstitutionHandler().getClass().getName()); 992 993 // <exportpath> node 994 String exportPathUnmodified = m_staticExportManager.getExportPathForConfiguration(); 995 // cut path seperator 996 if (exportPathUnmodified.endsWith(File.separator)) { 997 exportPathUnmodified = exportPathUnmodified.substring(0, exportPathUnmodified.length() - 1); 998 } 999 staticexportElement.addElement(N_STATICEXPORT_EXPORTPATH).addText(exportPathUnmodified); 1000 1001 // <exportworkpath> node 1002 String exportWorkPathUnmodified = m_staticExportManager.getExportWorkPathForConfiguration(); 1003 if (exportWorkPathUnmodified != null) { 1004 // cut path seperator 1005 if (exportWorkPathUnmodified.endsWith(File.separator)) { 1006 exportWorkPathUnmodified = exportWorkPathUnmodified.substring(0, exportWorkPathUnmodified.length() - 1); 1007 } 1008 staticexportElement.addElement(N_STATICEXPORT_EXPORTWORKPATH).addText(exportWorkPathUnmodified); 1009 } 1010 1011 // <exportbackups> node 1012 if (m_staticExportManager.getExportBackups() != null) { 1013 String exportBackupsUnmodified = String.valueOf(m_staticExportManager.getExportBackups()); 1014 staticexportElement.addElement(N_STATICEXPORT_EXPORTBACKUPS).addText(exportBackupsUnmodified); 1015 } 1016 1017 // <defaultpropertyvalue> node 1018 staticexportElement.addElement(N_STATICEXPORT_DEFAULT).addText(m_staticExportManager.getDefault()); 1019 1020 // <defaultsuffixes> node and its <suffix> sub nodes 1021 Element defaultsuffixesElement = staticexportElement.addElement(N_STATICEXPORT_DEFAULTSUFFIXES); 1022 1023 Iterator<String> exportSuffixes = m_staticExportManager.getExportSuffixes().iterator(); 1024 while (exportSuffixes.hasNext()) { 1025 String suffix = exportSuffixes.next(); 1026 Element suffixElement = defaultsuffixesElement.addElement(N_STATICEXPORT_SUFFIX); 1027 suffixElement.addAttribute(A_KEY, suffix); 1028 } 1029 1030 // <exportheaders> node and its <header> sub nodes 1031 Iterator<String> exportHandlers = m_staticExportManager.getExportHeaders().iterator(); 1032 if (exportHandlers.hasNext()) { 1033 Element exportheadersElement = staticexportElement.addElement(N_STATICEXPORT_EXPORTHEADERS); 1034 while (exportHandlers.hasNext()) { 1035 String header = exportHandlers.next(); 1036 exportheadersElement.addElement(N_STATICEXPORT_HEADER).addText(header); 1037 } 1038 } 1039 // <requestheaders> node and the <acceptlanguage> and <acceptcharset> node 1040 String acceptlanguage = m_staticExportManager.getAcceptLanguageHeader(); 1041 String acceptcharset = m_staticExportManager.getAcceptCharsetHeader(); 1042 String remoteaddr = m_staticExportManager.getRemoteAddr(); 1043 if ((acceptlanguage != null) || (acceptcharset != null) || (remoteaddr != null)) { 1044 Element requestheadersElement = staticexportElement.addElement(N_STATICEXPORT_REQUESTHEADERS); 1045 if (acceptlanguage != null) { 1046 requestheadersElement.addElement(N_STATICEXPORT_ACCEPTLANGUAGE).addText(acceptlanguage); 1047 } 1048 if (acceptcharset != null) { 1049 requestheadersElement.addElement(N_STATICEXPORT_ACCEPTCHARSET).addText(acceptcharset); 1050 } 1051 if (remoteaddr != null) { 1052 requestheadersElement.addElement(N_STATICEXPORT_REMOTEADDR).addText(remoteaddr); 1053 } 1054 } 1055 1056 // <rendersettings> node 1057 Element rendersettingsElement = staticexportElement.addElement(N_STATICEXPORT_RENDERSETTINGS); 1058 1059 // <rfsPrefix> node 1060 rendersettingsElement.addElement(N_STATICEXPORT_RFS_PREFIX).addText( 1061 m_staticExportManager.getRfsPrefixForConfiguration()); 1062 1063 // <vfsPrefix> node 1064 rendersettingsElement.addElement(N_STATICEXPORT_VFS_PREFIX).addText( 1065 m_staticExportManager.getVfsPrefixForConfiguration()); 1066 1067 // <userelativelinks> node 1068 rendersettingsElement.addElement(N_STATICEXPORT_RELATIVELINKS).addText( 1069 m_staticExportManager.getRelativeLinks()); 1070 1071 // <exporturl> node 1072 rendersettingsElement.addElement(N_STATICEXPORT_EXPORTURL).addText( 1073 m_staticExportManager.getExportUrlForConfiguration()); 1074 1075 // <plainoptimization> node 1076 rendersettingsElement.addElement(N_STATICEXPORT_PLAINOPTIMIZATION).addText( 1077 m_staticExportManager.getPlainExportOptimization()); 1078 1079 // <testresource> node 1080 Element testresourceElement = rendersettingsElement.addElement(N_STATICEXPORT_TESTRESOURCE); 1081 testresourceElement.addAttribute(A_URI, m_staticExportManager.getTestResource()); 1082 1083 // <resourcestorender> node and <regx> subnodes 1084 Element resourcetorenderElement = rendersettingsElement.addElement(N_STATICEXPORT_RESOURCESTORENDER); 1085 1086 Iterator<String> exportFolderPatterns = m_staticExportManager.getExportFolderPatterns().iterator(); 1087 while (exportFolderPatterns.hasNext()) { 1088 String pattern = exportFolderPatterns.next(); 1089 resourcetorenderElement.addElement(N_STATICEXPORT_REGEX).addText(pattern); 1090 } 1091 1092 if (!m_staticExportManager.getExportRules().isEmpty()) { 1093 // <export-rules> node 1094 Element exportRulesElement = resourcetorenderElement.addElement(N_STATICEXPORT_EXPORTRULES); 1095 1096 Iterator<CmsStaticExportExportRule> exportRules = m_staticExportManager.getExportRules().iterator(); 1097 while (exportRules.hasNext()) { 1098 CmsStaticExportExportRule rule = exportRules.next(); 1099 // <export-rule> node 1100 Element exportRuleElement = exportRulesElement.addElement(N_STATICEXPORT_EXPORTRULE); 1101 exportRuleElement.addElement(N_STATICEXPORT_NAME).addText(rule.getName()); 1102 exportRuleElement.addElement(N_STATICEXPORT_DESCRIPTION).addText(rule.getDescription()); 1103 // <modified-resources> node and <regex> subnodes 1104 Element modifiedElement = exportRuleElement.addElement(N_STATICEXPORT_MODIFIED); 1105 Iterator<Pattern> itMods = rule.getModifiedResources().iterator(); 1106 while (itMods.hasNext()) { 1107 Pattern regex = itMods.next(); 1108 modifiedElement.addElement(N_STATICEXPORT_REGEX).addText(regex.pattern()); 1109 } 1110 // <export-resources> node and <uri> subnodes 1111 Element exportResourcesElement = exportRuleElement.addElement(N_STATICEXPORT_EXPORT); 1112 Iterator<String> itExps = rule.getExportResourcePatterns().iterator(); 1113 while (itExps.hasNext()) { 1114 String uri = itExps.next(); 1115 exportResourcesElement.addElement(N_STATICEXPORT_URI).addText(uri); 1116 } 1117 } 1118 } 1119 1120 if (!m_staticExportManager.getRfsRules().isEmpty()) { 1121 // <rfs-rules> node 1122 Element rfsRulesElement = rendersettingsElement.addElement(N_STATICEXPORT_RFS_RULES); 1123 1124 Iterator<CmsStaticExportRfsRule> rfsRules = m_staticExportManager.getRfsRules().iterator(); 1125 while (rfsRules.hasNext()) { 1126 CmsStaticExportRfsRule rule = rfsRules.next(); 1127 // <rfs-rule> node and subnodes 1128 Element rfsRuleElement = rfsRulesElement.addElement(N_STATICEXPORT_RFS_RULE); 1129 rfsRuleElement.addElement(N_STATICEXPORT_NAME).addText(rule.getName()); 1130 rfsRuleElement.addElement(N_STATICEXPORT_DESCRIPTION).addText(rule.getDescription()); 1131 rfsRuleElement.addElement(N_STATICEXPORT_SOURCE).addText(rule.getSource().pattern()); 1132 rfsRuleElement.addElement(N_STATICEXPORT_RFS_PREFIX).addText(rule.getRfsPrefixConfigured()); 1133 rfsRuleElement.addElement(N_STATICEXPORT_EXPORTPATH).addText(rule.getExportPathConfigured()); 1134 if (rule.getExportWorkPathConfigured() != null) { 1135 rfsRuleElement.addElement(N_STATICEXPORT_EXPORTWORKPATH).addText( 1136 rule.getExportWorkPathConfigured()); 1137 } 1138 if (rule.getExportBackups() != null) { 1139 rfsRuleElement.addElement(N_STATICEXPORT_EXPORTBACKUPS).addText( 1140 String.valueOf(rule.getExportBackups())); 1141 } 1142 if (rule.getUseRelativeLinks() != null) { 1143 rfsRuleElement.addElement(N_STATICEXPORT_RELATIVELINKS).addText( 1144 rule.getUseRelativeLinks().toString()); 1145 } 1146 Element relatedSystemRes = rfsRuleElement.addElement(N_STATICEXPORT_RELATED_SYSTEM_RES); 1147 Iterator<Pattern> itSystemRes = rule.getRelatedSystemResources().iterator(); 1148 while (itSystemRes.hasNext()) { 1149 Pattern sysRes = itSystemRes.next(); 1150 relatedSystemRes.addElement(N_STATICEXPORT_REGEX).addText(sysRes.pattern()); 1151 } 1152 } 1153 1154 } 1155 1156 if (m_storedContentDeliveryConfiguration.isConfigured()) { 1157 // <storedcontentdelivery> node 1158 Element storedContentDeliveryElement = parent.addElement(N_STOREDCONTENTDELIVERY); 1159 storedContentDeliveryElement.addAttribute( 1160 A_ENABLED, 1161 String.valueOf(m_storedContentDeliveryConfiguration.isEnabled())); 1162 1163 // <enabledsuffixes> node and its <suffix> sub nodes 1164 if (m_storedContentDeliveryConfiguration.hasEnabledSuffixes()) { 1165 Element enabledSuffixesElement = storedContentDeliveryElement.addElement( 1166 N_STOREDCONTENTDELIVERY_ENABLEDSUFFIXES); 1167 Iterator<String> enabledSuffixes = m_storedContentDeliveryConfiguration.getEnabledSuffixes().iterator(); 1168 while (enabledSuffixes.hasNext()) { 1169 String suffix = enabledSuffixes.next(); 1170 Element suffixElement = enabledSuffixesElement.addElement(N_STATICEXPORT_SUFFIX); 1171 suffixElement.addAttribute(A_KEY, suffix); 1172 } 1173 } 1174 1175 } 1176 1177 if (m_sharedCacheConfiguration.isConfigured()) { 1178 // <sharedcache> node and its policies 1179 Element sharedCacheElement = parent.addElement(N_SHAREDCACHE); 1180 sharedCacheElement.addAttribute(A_ENABLED, String.valueOf(m_sharedCacheConfiguration.isEnabled())); 1181 for (CmsSharedCachePolicy policy : m_sharedCacheConfiguration.getCachePolicies()) { 1182 Element policyElement = sharedCacheElement.addElement(N_SHAREDCACHE_CACHEPOLICY); 1183 if (!policy.isDefault()) { 1184 policyElement.addAttribute("contenttype", policy.getContentType()); 1185 } 1186 policyElement.addElement(N_SHAREDCACHE_CLIENTMAXAGE).addText(String.valueOf(policy.getClientMaxAge())); 1187 policyElement.addElement(N_SHAREDCACHE_SHAREDMAXAGE).addText(String.valueOf(policy.getSharedMaxAge())); 1188 if (policy.getStaleIfError() != CmsSharedCachePolicy.DURATION_UNSET) { 1189 policyElement.addElement(N_SHAREDCACHE_STALEIFERROR).addText( 1190 String.valueOf(policy.getStaleIfError())); 1191 } 1192 } 1193 } 1194 1195 if (m_staticExportManager.getProtectedExportPath() != null) { 1196 Element streamingEl = parent.addElement(N_PROTECTED_EXPORT); 1197 streamingEl.addElement(N_STATICEXPORT_EXPORTPATH).setText(m_staticExportManager.getProtectedExportPath()); 1198 Element exportpoints = streamingEl.addElement(I_CmsXmlConfiguration.N_EXPORTPOINTS); 1199 for (Entry<String, String> entry : m_staticExportManager.getProtectedExportPoints().entrySet()) { 1200 Element point = exportpoints.addElement(I_CmsXmlConfiguration.N_EXPORTPOINT); 1201 point.addAttribute(I_CmsXmlConfiguration.A_URI, entry.getKey()); 1202 point.addAttribute(I_CmsXmlConfiguration.A_DESTINATION, entry.getValue()); 1203 } 1204 } 1205 1206 if (m_importExportManager.getUserExportSettings() != null) { 1207 // <usercsvexport> 1208 Element userExportElement = parent.addElement(N_USERCSVEXPORT); 1209 1210 userExportElement.addElement(N_SEPARATOR).setText( 1211 m_importExportManager.getUserExportSettings().getSeparator()); 1212 Element exportColumns = userExportElement.addElement(N_COLUMNS); 1213 List<String> exportColumnList = m_importExportManager.getUserExportSettings().getColumns(); 1214 Iterator<String> itExportColumnList = exportColumnList.iterator(); 1215 while (itExportColumnList.hasNext()) { 1216 exportColumns.addElement(N_COLUMN).setText(itExportColumnList.next()); 1217 } 1218 // </usercsvexport> 1219 } 1220 1221 if (m_repositoryManager.isConfigured()) { 1222 List<I_CmsRepository> repositories = m_repositoryManager.getRepositories(); 1223 if (repositories != null) { 1224 1225 // <repositories> node 1226 Element repositoriesElement = parent.addElement(N_REPOSITORIES); 1227 1228 Iterator<I_CmsRepository> repositoriesIt = repositories.iterator(); 1229 while (repositoriesIt.hasNext()) { 1230 1231 // <repository> node 1232 I_CmsRepository repository = repositoriesIt.next(); 1233 Element repositoryElement = repositoriesElement.addElement(N_REPOSITORY); 1234 repositoryElement.addAttribute(A_NAME, repository.getName()); 1235 repositoryElement.addAttribute(A_CLASS, repository.getClass().getName()); 1236 1237 // <params> node 1238 CmsParameterConfiguration config = repository.getConfiguration(); 1239 if ((config != null) && (config.size() > 0)) { 1240 Element paramsElement = repositoryElement.addElement(N_PARAMS); 1241 config.appendToXml(paramsElement); 1242 } 1243 1244 // <filter> node 1245 CmsRepositoryFilter filter = repository.getFilter(); 1246 if (filter != null) { 1247 List<Pattern> rules = filter.getFilterRules(); 1248 if (rules.size() > 0) { 1249 Element filterElement = repositoryElement.addElement(N_FILTER); 1250 filterElement.addAttribute(A_TYPE, filter.getType()); 1251 1252 // <regex> nodes 1253 Iterator<Pattern> it = rules.iterator(); 1254 while (it.hasNext()) { 1255 Pattern rule = it.next(); 1256 filterElement.addElement(N_REGEX).addText(rule.pattern()); 1257 } 1258 } 1259 } 1260 1261 CmsResourceTranslator translator = repository.getTranslation(); 1262 if (translator != null) { 1263 boolean translationEnabled = repository.isTranslationEnabled(); 1264 Element fileTransElem = repositoryElement.addElement(N_FILETRANSLATIONS); 1265 fileTransElem.addAttribute(A_ENABLED, "" + translationEnabled); 1266 String[] translationStrings = translator.getTranslations(); 1267 for (String translation : translationStrings) { 1268 fileTransElem.addElement(N_TRANSLATION).setText(translation); 1269 } 1270 } 1271 } 1272 } 1273 } 1274 CmsExtendedHtmlImportDefault htmlimport = m_importExportManager.getExtendedHtmlImportDefault(true); 1275 if (htmlimport != null) { 1276 // <extendedhtmlimport> 1277 Element htmlImportElement = parent.addElement(N_EXTHTMLIMPORT); 1278 // <destination> node 1279 if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getDestinationDir())) { 1280 htmlImportElement.addElement(N_EXTHTMLIMPORT_DESTINATION).setText(htmlimport.getDestinationDir()); 1281 } 1282 // <input> node 1283 if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getInputDir())) { 1284 htmlImportElement.addElement(N_EXTHTMLIMPORT_INPUT).setText(htmlimport.getInputDir()); 1285 } 1286 1287 // <galleries> node 1288 Element galleryElement = htmlImportElement.addElement(N_EXTHTMLIMPORT_GALLERIES); 1289 // <download> node 1290 if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getDownloadGallery())) { 1291 galleryElement.addElement(N_EXTHTMLIMPORT_DOWNLOAD).setText(htmlimport.getDownloadGallery()); 1292 } 1293 // <image> node 1294 if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getImageGallery())) { 1295 galleryElement.addElement(N_EXTHTMLIMPORT_IMAGE).setText(htmlimport.getImageGallery()); 1296 } 1297 // <externallink> node 1298 if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getLinkGallery())) { 1299 galleryElement.addElement(N_EXTHTMLIMPORT_EXTERNALLINK).setText(htmlimport.getLinkGallery()); 1300 } 1301 1302 // <settings> node 1303 Element settingElement = htmlImportElement.addElement(N_EXTHTMLIMPORT_SETTINGS); 1304 // <template> node 1305 settingElement.addElement(N_EXTHTMLIMPORT_TEMPLATE).setText(htmlimport.getTemplate()); 1306 // <element> node 1307 settingElement.addElement(N_EXTHTMLIMPORT_ELEMENT).setText(htmlimport.getElement()); 1308 // <locale> node 1309 settingElement.addElement(N_EXTHTMLIMPORT_LOCALE).setText(htmlimport.getLocale()); 1310 // <encoding> node 1311 settingElement.addElement(N_EXTHTMLIMPORT_ENCODING).setText(htmlimport.getEncoding()); 1312 1313 // <pattern> node 1314 Element patternElement = settingElement.addElement(N_EXTHTMLIMPORT_PATTERN); 1315 // <start> node 1316 if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getStartPattern())) { 1317 patternElement.addElement(N_EXTHTMLIMPORT_PATTERN_START).setText(htmlimport.getStartPattern()); 1318 } 1319 // <end> node 1320 if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getEndPattern())) { 1321 patternElement.addElement(N_EXTHTMLIMPORT_PATTERN_END).setText(htmlimport.getEndPattern()); 1322 } 1323 1324 // <overwrite> node 1325 settingElement.addElement(N_EXTHTMLIMPORT_OVERWRITE).setText(htmlimport.getOverwrite()); 1326 // <keepbrokenlinks> node 1327 settingElement.addElement(N_EXTHTMLIMPORT_KEEPBROKENLINKS).setText(htmlimport.getKeepBrokenLinks()); 1328 // </extendedhtmlimport> 1329 } 1330 1331 // return the configured node 1332 return importexportElement; 1333 } 1334 1335 /** 1336 * @see org.opencms.configuration.I_CmsXmlConfiguration#getDtdFilename() 1337 */ 1338 public String getDtdFilename() { 1339 1340 return CONFIGURATION_DTD_NAME; 1341 } 1342 1343 /** 1344 * Returns the initialized import/export manager.<p> 1345 * 1346 * @return the initialized import/export manager 1347 */ 1348 public CmsImportExportManager getImportExportManager() { 1349 1350 return m_importExportManager; 1351 } 1352 1353 /** 1354 * Returns the initialized repository manager.<p> 1355 * 1356 * @return the initialized repository manager 1357 */ 1358 public CmsRepositoryManager getRepositoryManager() { 1359 1360 return m_repositoryManager; 1361 } 1362 1363 /** 1364 * Returns the shared cache configuration.<p> 1365 * 1366 * @return the shared cache configuration 1367 */ 1368 public CmsSharedCacheConfiguration getSharedCacheConfiguration() { 1369 1370 return m_sharedCacheConfiguration; 1371 } 1372 1373 /** 1374 * Returns the initialized static export manager.<p> 1375 * 1376 * @return the initialized static export manager 1377 */ 1378 public CmsStaticExportManager getStaticExportManager() { 1379 1380 return m_staticExportManager; 1381 } 1382 1383 /** 1384 * Returns the stored content delivery configuration.<p> 1385 * 1386 * @return the stored content delivery configuration 1387 */ 1388 public CmsStoredContentDeliveryConfiguration getStoredContentDeliveryConfiguration() { 1389 1390 return m_storedContentDeliveryConfiguration; 1391 } 1392 1393 /** 1394 * Will be called when configuration of this object is finished.<p> 1395 */ 1396 public void initializeFinished() { 1397 1398 if (CmsLog.INIT.isInfoEnabled()) { 1399 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_IMPORT_CONFIG_FINISHED_0)); 1400 } 1401 } 1402 1403 /** 1404 * Sets the extendedHtmlImportManager.<p> 1405 * 1406 * @param extendedHtmlImportManager the extendedHtmlImportManager to set 1407 */ 1408 public void setExtendedHtmlImportManager(CmsExtendedHtmlImportDefault extendedHtmlImportManager) { 1409 1410 m_importExportManager.setExtendedHtmlImportDefault(extendedHtmlImportManager); 1411 } 1412 1413 /** 1414 * Sets the generated import/export manager.<p> 1415 * 1416 * @param manager the import/export manager to set 1417 */ 1418 public void setImportExportManager(CmsImportExportManager manager) { 1419 1420 m_importExportManager = manager; 1421 if (CmsLog.INIT.isInfoEnabled()) { 1422 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_IMPORT_MANAGER_0)); 1423 } 1424 } 1425 1426 /** 1427 * Sets the protected export path.<p> 1428 * 1429 * @param exportPath the export path to set 1430 */ 1431 public void setProtectedExportPath(String exportPath) { 1432 1433 m_staticExportManager.setProtectedExportPath(exportPath); 1434 } 1435 1436 /** 1437 * Sets the generated repository manager.<p> 1438 * 1439 * @param manager the repository manager to set 1440 */ 1441 public void setRepositoryManager(CmsRepositoryManager manager) { 1442 1443 m_repositoryManager = manager; 1444 } 1445 1446 /** 1447 * Sets the shared cache configuration.<p> 1448 * 1449 * @param configuration the shared cache configuration 1450 */ 1451 public void setSharedCacheConfiguration(CmsSharedCacheConfiguration configuration) { 1452 1453 m_sharedCacheConfiguration = configuration; 1454 if (CmsLog.INIT.isInfoEnabled()) { 1455 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SHAREDCACHE_CONFIG_0)); 1456 } 1457 } 1458 1459 /** 1460 * Sets the generated static export manager.<p> 1461 * 1462 * @param manager the static export manager to set 1463 */ 1464 public void setStaticExportManager(CmsStaticExportManager manager) { 1465 1466 m_staticExportManager = manager; 1467 if (CmsLog.INIT.isInfoEnabled()) { 1468 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_STATEXP_MANAGER_0)); 1469 } 1470 } 1471 1472 /** 1473 * Sets the stored content delivery configuration.<p> 1474 * 1475 * @param configuration the stored content delivery configuration 1476 */ 1477 public void setStoredContentDeliveryConfiguration(CmsStoredContentDeliveryConfiguration configuration) { 1478 1479 m_storedContentDeliveryConfiguration = configuration; 1480 if (CmsLog.INIT.isInfoEnabled()) { 1481 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_STOREDCONTENTDELIVERY_CONFIG_0)); 1482 } 1483 } 1484 1485 /** 1486 * Sets the user settings for export and import.<p> 1487 * 1488 * @param userExportSettings the user settings for export and import 1489 */ 1490 public void setUserExportSettings(CmsUserExportSettings userExportSettings) { 1491 1492 m_importExportManager.setUserExportSettings(userExportSettings); 1493 } 1494 1495 /** 1496 * Validates configuration combinations which can not be expressed in the DTD.<p> 1497 * 1498 * @throws CmsConfigurationException if the configuration is invalid 1499 */ 1500 public void validate() throws CmsConfigurationException { 1501 1502 m_sharedCacheConfiguration.validate(); 1503 if (!m_sharedCacheConfiguration.isEnabled()) { 1504 return; 1505 } 1506 if (m_storedContentDeliveryConfiguration.isEnabled()) { 1507 throw new CmsConfigurationException( 1508 Messages.get().container(Messages.ERR_SHAREDCACHE_CONFLICT_STOREDCONTENT_0)); 1509 } 1510 if (!m_staticExportManager.isStaticExportEnabled()) { 1511 throw new CmsConfigurationException( 1512 Messages.get().container(Messages.ERR_SHAREDCACHE_STATICEXPORT_DISABLED_0)); 1513 } 1514 if (!(m_staticExportManager.getHandler() instanceof A_CmsOnDemandStaticExportHandler)) { 1515 throw new CmsConfigurationException( 1516 Messages.get().container( 1517 Messages.ERR_SHAREDCACHE_HANDLER_1, 1518 m_staticExportManager.getHandler().getClass().getName())); 1519 } 1520 for (String header : m_staticExportManager.getExportHeaders()) { 1521 int separator = header.indexOf(':'); 1522 String name = separator < 0 ? header : header.substring(0, separator); 1523 if ("cache-control".equalsIgnoreCase(name.trim())) { 1524 throw new CmsConfigurationException( 1525 Messages.get().container(Messages.ERR_SHAREDCACHE_CACHE_CONTROL_HEADER_0)); 1526 } 1527 } 1528 } 1529 1530 /** 1531 * @see org.opencms.configuration.A_CmsXmlConfiguration#initMembers() 1532 */ 1533 @Override 1534 protected void initMembers() { 1535 1536 setXmlFileName(DEFAULT_XML_FILE_NAME); 1537 if (CmsLog.INIT.isInfoEnabled()) { 1538 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_IMPORT_CONFIG_INIT_0)); 1539 } 1540 } 1541 1542}