1 31 32 package org.opencms.configuration; 33 34 import org.opencms.importexport.CmsImportExportManager; 35 import org.opencms.importexport.I_CmsImportExportHandler; 36 import org.opencms.main.CmsLog; 37 import org.opencms.security.I_CmsPrincipal; 38 import org.opencms.staticexport.CmsStaticExportExportRule; 39 import org.opencms.staticexport.CmsStaticExportManager; 40 import org.opencms.staticexport.CmsStaticExportRfsRule; 41 42 import java.io.File ; 43 import java.util.Iterator ; 44 import java.util.List ; 45 import java.util.regex.Pattern ; 46 47 import org.apache.commons.digester.Digester; 48 49 import org.dom4j.Element; 50 51 60 public class CmsImportExportConfiguration extends A_CmsXmlConfiguration implements I_CmsXmlConfiguration { 61 62 63 public static final String CONFIGURATION_DTD_NAME = "opencms-importexport.dtd"; 64 65 66 public static final String DEFAULT_XML_FILE_NAME = "opencms-importexport.xml"; 67 68 69 protected static final String N_CONVERT = "convert"; 70 71 72 protected static final String N_IGNOREDPROPERTIES = "ignoredproperties"; 73 74 75 protected static final String N_IMMUTABLES = "immutables"; 76 77 78 protected static final String N_IMPORT = "import"; 79 80 81 protected static final String N_IMPORTEXPORT = "importexport"; 82 83 84 protected static final String N_IMPORTEXPORTHANDLER = "importexporthandler"; 85 86 87 protected static final String N_IMPORTEXPORTHANDLERS = "importexporthandlers"; 88 89 90 protected static final String N_IMPORTVERSION = "importversion"; 91 92 93 protected static final String N_IMPORTVERSIONS = "importversions"; 94 95 96 protected static final String N_OLDWEBAPPURL = "oldwebappurl"; 97 98 99 protected static final String N_OVERWRITE = "overwrite"; 100 101 102 protected static final String N_PRINCIPALTRANSLATION = "principaltranslation"; 103 104 105 protected static final String N_PRINCIPALTRANSLATIONS = "principaltranslations"; 106 107 108 protected static final String N_STATICEXPORT = "staticexport"; 109 110 111 protected static final String N_STATICEXPORT_ACCEPTCHARSET = "acceptcharset"; 112 113 114 protected static final String N_STATICEXPORT_ACCEPTLANGUAGE = "acceptlanguage"; 115 116 117 protected static final String N_STATICEXPORT_DEFAULT = "defaultpropertyvalue"; 118 119 120 protected static final String N_STATICEXPORT_DEFAULTSUFFIXES = "defaultsuffixes"; 121 122 123 protected static final String N_STATICEXPORT_DESCRIPTION = "description"; 124 125 126 protected static final String N_STATICEXPORT_EXPORT = "export-resources"; 127 128 129 protected static final String N_STATICEXPORT_EXPORTHEADERS = "exportheaders"; 130 131 132 protected static final String N_STATICEXPORT_EXPORTPATH = "exportpath"; 133 134 135 protected static final String N_STATICEXPORT_EXPORTRULE = "export-rule"; 136 137 138 protected static final String N_STATICEXPORT_EXPORTRULES = "export-rules"; 139 140 141 protected static final String N_STATICEXPORT_EXPORTURL = "exporturl"; 142 143 144 protected static final String N_STATICEXPORT_HANDLER = "staticexporthandler"; 145 146 147 protected static final String N_STATICEXPORT_HEADER = "header"; 148 149 150 protected static final String N_STATICEXPORT_MODIFIED = "modified-resources"; 151 152 153 protected static final String N_STATICEXPORT_NAME = "name"; 154 155 156 protected static final String N_STATICEXPORT_PLAINOPTIMIZATION = "plainoptimization"; 157 158 159 protected static final String N_STATICEXPORT_REGEX = "regex"; 160 161 162 protected static final String N_STATICEXPORT_RELATED_SYSTEM_RES = "related-system-res"; 163 164 165 protected static final String N_STATICEXPORT_RELATIVELINKS = "userelativelinks"; 166 167 168 protected static final String N_STATICEXPORT_REMOTEADDR = "remoteaddr"; 169 170 171 protected static final String N_STATICEXPORT_RENDERSETTINGS = "rendersettings"; 172 173 174 protected static final String N_STATICEXPORT_REQUESTHEADERS = "requestheaders"; 175 176 177 protected static final String N_STATICEXPORT_RESOURCESTORENDER = "resourcestorender"; 178 179 180 protected static final String N_STATICEXPORT_RFS_PREFIX = "rfs-prefix"; 181 182 183 protected static final String N_STATICEXPORT_RFS_RULE = "rfs-rule"; 184 185 186 protected static final String N_STATICEXPORT_RFS_RULES = "rfs-rules"; 187 188 189 protected static final String N_STATICEXPORT_SOURCE = "source"; 190 191 192 protected static final String N_STATICEXPORT_SUFFIX = "suffix"; 193 194 195 protected static final String N_STATICEXPORT_TESTRESOURCE = "testresource"; 196 197 198 protected static final String N_STATICEXPORT_URI = "uri"; 199 200 201 protected static final String N_STATICEXPORT_VFS_PREFIX = "vfs-prefix"; 202 203 204 private CmsImportExportManager m_importExportManager; 205 206 207 private CmsStaticExportManager m_staticExportManager; 208 209 212 public CmsImportExportConfiguration() { 213 214 setXmlFileName(DEFAULT_XML_FILE_NAME); 215 if (CmsLog.INIT.isInfoEnabled()) { 216 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_IMPORT_CONFIG_INIT_0)); 217 } 218 } 219 220 223 public void addXmlDigesterRules(Digester digester) { 224 225 digester.addCallMethod("*/" + N_IMPORTEXPORT, "initializeFinished"); 227 228 digester.addObjectCreate("*/" + N_IMPORTEXPORT, CmsImportExportManager.class); 230 digester.addSetNext("*/" + N_IMPORTEXPORT, "setImportExportManager"); 232 233 digester.addObjectCreate( 235 "*/" + N_IMPORTEXPORT + "/" + N_IMPORTEXPORTHANDLERS + "/" + N_IMPORTEXPORTHANDLER, 236 A_CLASS, 237 CmsConfigurationException.class); 238 digester.addSetNext( 239 "*/" + N_IMPORTEXPORT + "/" + N_IMPORTEXPORTHANDLERS + "/" + N_IMPORTEXPORTHANDLER, 240 "addImportExportHandler"); 241 242 digester.addCallMethod( 244 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_OVERWRITE, 245 "setOverwriteCollidingResources", 246 0); 247 248 digester.addCallMethod("*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_CONVERT, "setConvertToXmlPage", 0); 250 251 digester.addCallMethod("*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_OLDWEBAPPURL, "setOldWebAppUrl", 0); 253 254 digester.addObjectCreate("*/" 256 + N_IMPORTEXPORT 257 + "/" 258 + N_IMPORT 259 + "/" 260 + N_IMPORTVERSIONS 261 + "/" 262 + N_IMPORTVERSION, A_CLASS, CmsConfigurationException.class); 263 digester.addSetNext( 264 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_IMPORTVERSIONS + "/" + N_IMPORTVERSION, 265 "addImportVersionClass"); 266 267 digester.addCallMethod( 269 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_IMMUTABLES + "/" + N_RESOURCE, 270 "addImmutableResource", 271 1); 272 digester.addCallParam("*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_IMMUTABLES + "/" + N_RESOURCE, 0, A_URI); 273 274 digester.addCallMethod("*/" 276 + N_IMPORTEXPORT 277 + "/" 278 + N_IMPORT 279 + "/" 280 + N_PRINCIPALTRANSLATIONS 281 + "/" 282 + N_PRINCIPALTRANSLATION, "addImportPrincipalTranslation", 3); 283 digester.addCallParam("*/" 284 + N_IMPORTEXPORT 285 + "/" 286 + N_IMPORT 287 + "/" 288 + N_PRINCIPALTRANSLATIONS 289 + "/" 290 + N_PRINCIPALTRANSLATION, 0, A_TYPE); 291 digester.addCallParam("*/" 292 + N_IMPORTEXPORT 293 + "/" 294 + N_IMPORT 295 + "/" 296 + N_PRINCIPALTRANSLATIONS 297 + "/" 298 + N_PRINCIPALTRANSLATION, 1, A_FROM); 299 digester.addCallParam("*/" 300 + N_IMPORTEXPORT 301 + "/" 302 + N_IMPORT 303 + "/" 304 + N_PRINCIPALTRANSLATIONS 305 + "/" 306 + N_PRINCIPALTRANSLATION, 2, A_TO); 307 308 digester.addCallMethod( 310 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_IGNOREDPROPERTIES + "/" + N_PROPERTY, 311 "addIgnoredProperty", 312 1); 313 digester.addCallParam( 314 "*/" + N_IMPORTEXPORT + "/" + N_IMPORT + "/" + N_IGNOREDPROPERTIES + "/" + N_PROPERTY, 315 0, 316 A_NAME); 317 318 digester.addObjectCreate("*/" + N_STATICEXPORT, CmsStaticExportManager.class); 320 digester.addSetNext("*/" + N_STATICEXPORT, "setStaticExportManager"); 322 digester.addCallMethod("*/" + N_STATICEXPORT, "setExportEnabled", 1); 324 digester.addCallParam("*/" + N_STATICEXPORT, 0, A_ENABLED); 325 digester.addCallMethod("*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_HANDLER, "setHandler", 0); 327 digester.addCallMethod("*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_EXPORTPATH, "setExportPath", 0); 329 digester.addCallMethod("*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_DEFAULT, "setDefault", 0); 331 digester.addCallMethod("*/" 333 + N_STATICEXPORT 334 + "/" 335 + N_STATICEXPORT_DEFAULTSUFFIXES 336 + "/" 337 + N_STATICEXPORT_SUFFIX, "setExportSuffix", 1); 338 digester.addCallParam("*/" 339 + N_STATICEXPORT 340 + "/" 341 + N_STATICEXPORT_DEFAULTSUFFIXES 342 + "/" 343 + N_STATICEXPORT_SUFFIX, 0, A_KEY); 344 digester.addCallMethod( 346 "*/" + N_STATICEXPORT + "/" + N_STATICEXPORT_EXPORTHEADERS + "/" + N_STATICEXPORT_HEADER, 347 "setExportHeader", 348 0); 349 digester.addCallMethod("*/" 351 + N_STATICEXPORT 352 + "/" 353 + N_STATICEXPORT_REQUESTHEADERS 354 + "/" 355 + N_STATICEXPORT_ACCEPTLANGUAGE, "setAcceptLanguageHeader", 0); 356 digester.addCallMethod("*/" 358 + N_STATICEXPORT 359 + "/" 360 + N_STATICEXPORT_REQUESTHEADERS 361 + "/" 362 + N_STATICEXPORT_ACCEPTCHARSET, "setAcceptCharsetHeader", 0); 363 digester.addCallMethod("*/" 365 + N_STATICEXPORT 366 + "/" 367 + N_STATICEXPORT_REQUESTHEADERS 368 + "/" 369 + N_STATICEXPORT_REMOTEADDR, "setRemoteAddr", 0); 370 digester.addCallMethod("*/" 372 + N_STATICEXPORT 373 + "/" 374 + N_STATICEXPORT_RENDERSETTINGS 375 + "/" 376 + N_STATICEXPORT_RFS_PREFIX, "setRfsPrefix", 0); 377 digester.addCallMethod("*/" 379 + N_STATICEXPORT 380 + "/" 381 + N_STATICEXPORT_RENDERSETTINGS 382 + "/" 383 + N_STATICEXPORT_VFS_PREFIX, "setVfsPrefix", 0); 384 digester.addCallMethod("*/" 386 + N_STATICEXPORT 387 + "/" 388 + N_STATICEXPORT_RENDERSETTINGS 389 + "/" 390 + N_STATICEXPORT_RELATIVELINKS, "setRelativeLinks", 0); 391 digester.addCallMethod("*/" 393 + N_STATICEXPORT 394 + "/" 395 + N_STATICEXPORT_RENDERSETTINGS 396 + "/" 397 + N_STATICEXPORT_EXPORTURL, "setExportUrl", 0); 398 digester.addCallMethod("*/" 400 + N_STATICEXPORT 401 + "/" 402 + N_STATICEXPORT_RENDERSETTINGS 403 + "/" 404 + N_STATICEXPORT_PLAINOPTIMIZATION, "setPlainExportOptimization", 0); 405 digester.addCallMethod("*/" 407 + N_STATICEXPORT 408 + "/" 409 + N_STATICEXPORT_RENDERSETTINGS 410 + "/" 411 + N_STATICEXPORT_TESTRESOURCE, "setTestResource", 1); 412 digester.addCallParam("*/" 413 + N_STATICEXPORT 414 + "/" 415 + N_STATICEXPORT_RENDERSETTINGS 416 + "/" 417 + N_STATICEXPORT_TESTRESOURCE, 0, A_URI); 418 digester.addCallMethod("*/" 420 + N_STATICEXPORT 421 + "/" 422 + N_STATICEXPORT_RENDERSETTINGS 423 + "/" 424 + N_STATICEXPORT_RESOURCESTORENDER 425 + "/" 426 + N_STATICEXPORT_REGEX, "setExportFolderPattern", 0); 427 428 String exportRulePath = "*/" 430 + N_STATICEXPORT 431 + "/" 432 + N_STATICEXPORT_RENDERSETTINGS 433 + "/" 434 + N_STATICEXPORT_RESOURCESTORENDER 435 + "/" 436 + N_STATICEXPORT_EXPORTRULES 437 + "/" 438 + N_STATICEXPORT_EXPORTRULE; 439 digester.addCallMethod(exportRulePath, "addExportRule", 2); 440 digester.addCallParam(exportRulePath + "/" + N_STATICEXPORT_NAME, 0); 441 digester.addCallParam(exportRulePath + "/" + N_STATICEXPORT_DESCRIPTION, 1); 442 digester.addCallMethod( 443 exportRulePath + "/" + N_STATICEXPORT_MODIFIED + "/" + N_STATICEXPORT_REGEX, 444 "addExportRuleRegex", 445 1); 446 digester.addCallParam(exportRulePath + "/" + N_STATICEXPORT_MODIFIED + "/" + N_STATICEXPORT_REGEX, 0); 447 digester.addCallMethod( 448 exportRulePath + "/" + N_STATICEXPORT_EXPORT + "/" + N_STATICEXPORT_URI, 449 "addExportRuleUri", 450 1); 451 digester.addCallParam(exportRulePath + "/" + N_STATICEXPORT_EXPORT + "/" + N_STATICEXPORT_URI, 0); 452 453 String rfsRulePath = "*/" 455 + N_STATICEXPORT 456 + "/" 457 + N_STATICEXPORT_RENDERSETTINGS 458 + "/" 459 + N_STATICEXPORT_RFS_RULES 460 + "/" 461 + N_STATICEXPORT_RFS_RULE; 462 digester.addCallMethod(rfsRulePath, "addRfsRule", 6); 463 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_NAME, 0); 464 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_DESCRIPTION, 1); 465 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_SOURCE, 2); 466 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_RFS_PREFIX, 3); 467 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_EXPORTPATH, 4); 468 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_RELATIVELINKS, 5); 469 digester.addCallMethod( 471 rfsRulePath + "/" + N_STATICEXPORT_RELATED_SYSTEM_RES + "/" + N_STATICEXPORT_REGEX, 472 "addRfsRuleSystemRes", 473 1); 474 digester.addCallParam(rfsRulePath + "/" + N_STATICEXPORT_RELATED_SYSTEM_RES + "/" + N_STATICEXPORT_REGEX, 0); 475 } 476 477 480 public Element generateXml(Element parent) { 481 482 Element importexportElement = parent.addElement(N_IMPORTEXPORT); 484 485 Element resourceloadersElement = importexportElement.addElement(N_IMPORTEXPORTHANDLERS); 486 List handlers = m_importExportManager.getImportExportHandlers(); 487 Iterator i = handlers.iterator(); 488 while (i.hasNext()) { 489 I_CmsImportExportHandler handler = (I_CmsImportExportHandler)i.next(); 490 Element loaderNode = resourceloadersElement.addElement(N_IMPORTEXPORTHANDLER); 492 loaderNode.addAttribute(A_CLASS, handler.getClass().getName()); 493 } 494 495 Element importElement = importexportElement.addElement(N_IMPORT); 496 497 importElement.addElement(N_OVERWRITE).setText( 499 (new Boolean (m_importExportManager.overwriteCollidingResources())).toString()); 500 501 importElement.addElement(N_CONVERT).setText((new Boolean (m_importExportManager.convertToXmlPage())).toString()); 503 504 if (m_importExportManager.getOldWebAppUrl() != null) { 506 importElement.addElement(N_OLDWEBAPPURL).setText(m_importExportManager.getOldWebAppUrl()); 507 } 508 509 Element resourcetypesElement = importElement.addElement(N_IMPORTVERSIONS); 511 i = m_importExportManager.getImportVersionClasses().iterator(); 512 while (i.hasNext()) { 513 resourcetypesElement.addElement(N_IMPORTVERSION).addAttribute(A_CLASS, i.next().getClass().getName()); 514 } 515 516 Element immutablesElement = importElement.addElement(N_IMMUTABLES); 518 i = m_importExportManager.getImmutableResources().iterator(); 519 while (i.hasNext()) { 520 String uri = (String )i.next(); 521 immutablesElement.addElement(N_RESOURCE).addAttribute(A_URI, uri); 522 } 523 524 Element principalsElement = importElement.addElement(N_PRINCIPALTRANSLATIONS); 526 i = m_importExportManager.getImportUserTranslations().keySet().iterator(); 527 while (i.hasNext()) { 528 String from = (String )i.next(); 529 String to = (String )m_importExportManager.getImportUserTranslations().get(from); 530 principalsElement.addElement(N_PRINCIPALTRANSLATION).addAttribute(A_TYPE, I_CmsPrincipal.PRINCIPAL_USER).addAttribute( 531 A_FROM, 532 from).addAttribute(A_TO, to); 533 } 534 i = m_importExportManager.getImportGroupTranslations().keySet().iterator(); 535 while (i.hasNext()) { 536 String from = (String )i.next(); 537 String to = (String )m_importExportManager.getImportGroupTranslations().get(from); 538 principalsElement.addElement(N_PRINCIPALTRANSLATION).addAttribute(A_TYPE, I_CmsPrincipal.PRINCIPAL_GROUP).addAttribute( 539 A_FROM, 540 from).addAttribute(A_TO, to); 541 } 542 543 Element propertiesElement = importElement.addElement(N_IGNOREDPROPERTIES); 545 i = m_importExportManager.getIgnoredProperties().iterator(); 546 while (i.hasNext()) { 547 String property = (String )i.next(); 548 propertiesElement.addElement(N_PROPERTY).addAttribute(A_NAME, property); 549 } 550 551 Element staticexportElement = parent.addElement(N_STATICEXPORT); 553 staticexportElement.addAttribute(A_ENABLED, m_staticExportManager.getExportEnabled()); 554 555 staticexportElement.addElement(N_STATICEXPORT_HANDLER).addText( 557 m_staticExportManager.getHandler().getClass().getName()); 558 559 String exportPathUnmodified = m_staticExportManager.getExportPathForConfiguration(); 561 if (exportPathUnmodified.endsWith(File.separator)) { 563 exportPathUnmodified = exportPathUnmodified.substring(0, exportPathUnmodified.length() - 1); 564 } 565 staticexportElement.addElement(N_STATICEXPORT_EXPORTPATH).addText(exportPathUnmodified); 566 567 staticexportElement.addElement(N_STATICEXPORT_DEFAULT).addText(m_staticExportManager.getDefault()); 569 570 Element defaultsuffixesElement = staticexportElement.addElement(N_STATICEXPORT_DEFAULTSUFFIXES); 572 573 i = m_staticExportManager.getExportSuffixes().iterator(); 574 while (i.hasNext()) { 575 String suffix = (String )i.next(); 576 Element suffixElement = defaultsuffixesElement.addElement(N_STATICEXPORT_SUFFIX); 577 suffixElement.addAttribute(A_KEY, suffix); 578 } 579 580 i = m_staticExportManager.getExportHeaders().iterator(); 582 if (i.hasNext()) { 583 Element exportheadersElement = staticexportElement.addElement(N_STATICEXPORT_EXPORTHEADERS); 584 while (i.hasNext()) { 585 String header = (String )i.next(); 586 exportheadersElement.addElement(N_STATICEXPORT_HEADER).addText(header); 587 } 588 } 589 String acceptlanguage = m_staticExportManager.getAcceptLanguageHeader(); 591 String acceptcharset = m_staticExportManager.getAcceptCharsetHeader(); 592 String remoteaddr = m_staticExportManager.getRemoteAddr(); 593 if ((acceptlanguage != null) || (acceptcharset != null) || (remoteaddr != null)) { 594 Element requestheadersElement = staticexportElement.addElement(N_STATICEXPORT_REQUESTHEADERS); 595 if (acceptlanguage != null) { 596 requestheadersElement.addElement(N_STATICEXPORT_ACCEPTLANGUAGE).addText(acceptlanguage); 597 } 598 if (acceptcharset != null) { 599 requestheadersElement.addElement(N_STATICEXPORT_ACCEPTCHARSET).addText(acceptcharset); 600 } 601 if (remoteaddr != null) { 602 requestheadersElement.addElement(N_STATICEXPORT_REMOTEADDR).addText(remoteaddr); 603 } 604 } 605 606 Element rendersettingsElement = staticexportElement.addElement(N_STATICEXPORT_RENDERSETTINGS); 608 609 rendersettingsElement.addElement(N_STATICEXPORT_RFS_PREFIX).addText( 611 m_staticExportManager.getRfsPrefixForConfiguration()); 612 613 rendersettingsElement.addElement(N_STATICEXPORT_VFS_PREFIX).addText( 615 m_staticExportManager.getVfsPrefixForConfiguration()); 616 617 rendersettingsElement.addElement(N_STATICEXPORT_RELATIVELINKS).addText(m_staticExportManager.getRelativeLinks()); 619 620 rendersettingsElement.addElement(N_STATICEXPORT_EXPORTURL).addText( 622 m_staticExportManager.getExportUrlForConfiguration()); 623 624 rendersettingsElement.addElement(N_STATICEXPORT_PLAINOPTIMIZATION).addText( 626 m_staticExportManager.getPlainExportOptimization()); 627 628 Element testresourceElement = rendersettingsElement.addElement(N_STATICEXPORT_TESTRESOURCE); 630 testresourceElement.addAttribute(A_URI, m_staticExportManager.getTestResource()); 631 632 Element resourcetorenderElement = rendersettingsElement.addElement(N_STATICEXPORT_RESOURCESTORENDER); 634 635 i = m_staticExportManager.getExportFolderPatterns().iterator(); 636 while (i.hasNext()) { 637 String pattern = (String )i.next(); 638 resourcetorenderElement.addElement(N_STATICEXPORT_REGEX).addText(pattern); 639 } 640 641 if (!m_staticExportManager.getExportRules().isEmpty()) { 642 Element exportRulesElement = resourcetorenderElement.addElement(N_STATICEXPORT_EXPORTRULES); 644 645 i = m_staticExportManager.getExportRules().iterator(); 646 while (i.hasNext()) { 647 CmsStaticExportExportRule rule = (CmsStaticExportExportRule)i.next(); 648 Element exportRuleElement = exportRulesElement.addElement(N_STATICEXPORT_EXPORTRULE); 650 exportRuleElement.addElement(N_STATICEXPORT_NAME).addText(rule.getName()); 651 exportRuleElement.addElement(N_STATICEXPORT_DESCRIPTION).addText(rule.getDescription()); 652 Element modifiedElement = exportRuleElement.addElement(N_STATICEXPORT_MODIFIED); 654 Iterator itMods = rule.getModifiedResources().iterator(); 655 while (itMods.hasNext()) { 656 Pattern regex = (Pattern )itMods.next(); 657 modifiedElement.addElement(N_STATICEXPORT_REGEX).addText(regex.pattern()); 658 } 659 Element exportElement = exportRuleElement.addElement(N_STATICEXPORT_EXPORT); 661 Iterator itExps = rule.getExportResourcePatterns().iterator(); 662 while (itExps.hasNext()) { 663 String uri = (String )itExps.next(); 664 exportElement.addElement(N_STATICEXPORT_URI).addText(uri); 665 } 666 } 667 } 668 669 if (!m_staticExportManager.getRfsRules().isEmpty()) { 670 Element rfsRulesElement = rendersettingsElement.addElement(N_STATICEXPORT_RFS_RULES); 672 673 i = m_staticExportManager.getRfsRules().iterator(); 674 while (i.hasNext()) { 675 CmsStaticExportRfsRule rule = (CmsStaticExportRfsRule)i.next(); 676 Element rfsRuleElement = rfsRulesElement.addElement(N_STATICEXPORT_RFS_RULE); 678 rfsRuleElement.addElement(N_STATICEXPORT_NAME).addText(rule.getName()); 679 rfsRuleElement.addElement(N_STATICEXPORT_DESCRIPTION).addText(rule.getDescription()); 680 rfsRuleElement.addElement(N_STATICEXPORT_SOURCE).addText(rule.getSource().pattern()); 681 rfsRuleElement.addElement(N_STATICEXPORT_RFS_PREFIX).addText(rule.getRfsPrefixConfigured()); 682 rfsRuleElement.addElement(N_STATICEXPORT_EXPORTPATH).addText(rule.getExportPathConfigured()); 683 if (rule.getUseRelativeLinks() != null) { 684 rfsRuleElement.addElement(N_STATICEXPORT_RELATIVELINKS).addText( 685 rule.getUseRelativeLinks().toString()); 686 } 687 Element relatedSystemRes = rfsRuleElement.addElement(N_STATICEXPORT_RELATED_SYSTEM_RES); 688 Iterator itSystemRes = rule.getRelatedSystemResources().iterator(); 689 while (itSystemRes.hasNext()) { 690 Pattern sysRes = (Pattern )itSystemRes.next(); 691 relatedSystemRes.addElement(N_STATICEXPORT_REGEX).addText(sysRes.pattern()); 692 } 693 } 694 695 } 696 return importexportElement; 698 } 699 700 703 public String getDtdFilename() { 704 705 return CONFIGURATION_DTD_NAME; 706 } 707 708 713 public CmsImportExportManager getImportExportManager() { 714 715 return m_importExportManager; 716 } 717 718 723 public CmsStaticExportManager getStaticExportManager() { 724 725 return m_staticExportManager; 726 } 727 728 731 public void initializeFinished() { 732 733 if (CmsLog.INIT.isInfoEnabled()) { 734 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_IMPORT_CONFIG_FINISHED_0)); 735 } 736 } 737 738 743 public void setImportExportManager(CmsImportExportManager manager) { 744 745 m_importExportManager = manager; 746 if (CmsLog.INIT.isInfoEnabled()) { 747 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_IMPORT_MANAGER_0)); 748 } 749 } 750 751 756 public void setStaticExportManager(CmsStaticExportManager manager) { 757 758 m_staticExportManager = manager; 759 if (CmsLog.INIT.isInfoEnabled()) { 760 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_STATEXP_MANAGER_0)); 761 } 762 } 763 } | Popular Tags |