001/* 002 * Copyright 2010 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.cms.transformation.docbook; 017 018/** 019 * This class represent a enhancement to docbook 020 */ 021public class DocbookEnhancer 022{ 023 private String _htmleditor2DocbookXSLT; 024 private String _docbook2HTMLEditorXSLT; 025 private String _docbook2outgoingReferencesXSLT; 026 private String _docbook2HTMLXSLT; 027 private String _docbook2HTMLHandler; 028 private String _htmleditor2docbookHandler; 029 private String _docbook2htmleditorHandler; 030 031 /** 032 * Create a docbook enhancer 033 * @param pluginName The name of the plugin declaring the enhancer 034 * @param htmleditor2DocbookXSLT The fullpath to the xslt file or relative to the current plugin 035 * @param docbook2HTMLEditorXSLT The fullpath to the xslt file or relative to the current plugin 036 * @param docbook2HTMLXSLT The fullpath to the xslt file or relative to the current plugin 037 * @param docbook2outgoingReferencesXSLT The fullpath to the xslt file or relative to the current plugin 038 * @param docbook2HTMLHandler The role of a component that implements EnhancementTransformer 039 * @param htmleditor2DocbookHandler The role of a component that implements EnhancementTransformer 040 * @param docbook2htmleditorHandler The role of a component that implements EnhancementTransformer 041 */ 042 public DocbookEnhancer(String pluginName, String htmleditor2DocbookXSLT, String docbook2HTMLEditorXSLT, String docbook2HTMLXSLT, String docbook2outgoingReferencesXSLT, String docbook2HTMLHandler, String htmleditor2DocbookHandler, String docbook2htmleditorHandler) 043 { 044 if (htmleditor2DocbookXSLT != null && htmleditor2DocbookXSLT.indexOf("://") == -1 && !htmleditor2DocbookXSLT.startsWith("/")) 045 { 046 _htmleditor2DocbookXSLT = "plugin:" + pluginName + "://" + htmleditor2DocbookXSLT; 047 } 048 else 049 { 050 _htmleditor2DocbookXSLT = htmleditor2DocbookXSLT; 051 } 052 053 if (docbook2HTMLEditorXSLT != null && docbook2HTMLEditorXSLT.indexOf("://") == -1 && !docbook2HTMLEditorXSLT.startsWith("/")) 054 { 055 _docbook2HTMLEditorXSLT = "plugin:" + pluginName + "://" + docbook2HTMLEditorXSLT; 056 } 057 else 058 { 059 _docbook2HTMLEditorXSLT = docbook2HTMLEditorXSLT; 060 } 061 062 if (docbook2HTMLXSLT != null && docbook2HTMLXSLT.indexOf("://") == -1 && !docbook2HTMLXSLT.startsWith("/")) 063 { 064 _docbook2HTMLXSLT = "plugin:" + pluginName + "://" + docbook2HTMLXSLT; 065 } 066 else 067 { 068 _docbook2HTMLXSLT = docbook2HTMLXSLT; 069 } 070 071 if (docbook2outgoingReferencesXSLT != null && docbook2outgoingReferencesXSLT.indexOf("://") == -1 && !docbook2outgoingReferencesXSLT.startsWith("/")) 072 { 073 _docbook2outgoingReferencesXSLT = "plugin:" + pluginName + "://" + docbook2outgoingReferencesXSLT; 074 } 075 else 076 { 077 _docbook2outgoingReferencesXSLT = docbook2outgoingReferencesXSLT; 078 } 079 080 _docbook2HTMLHandler = docbook2HTMLHandler; 081 _htmleditor2docbookHandler = htmleditor2DocbookHandler; 082 _docbook2htmleditorHandler = docbook2htmleditorHandler; 083 } 084 085 /** 086 * Get the xslt to use when transforming from htmleditor to docbook 087 * @return The fullpath to a xslt file 088 */ 089 public String getHTMLEditor2DocbookXSLT() 090 { 091 return _htmleditor2DocbookXSLT; 092 } 093 094 /** 095 * Get the xslt to use when transforming from docbook to htmleditor 096 * @return The fullpath to a xslt file 097 */ 098 public String getDocbook2HTMLEditorXSLT() 099 { 100 return _docbook2HTMLEditorXSLT; 101 } 102 103 /** 104 * Get the xslt to use when transforming from docbook to html 105 * @return The fullpath to a xslt file 106 */ 107 public String getDocbook2HTMLXSLT() 108 { 109 return _docbook2HTMLXSLT; 110 } 111 112 /** 113 * Get the xslt to use when transforming from docbook to html 114 * @return The fullpath to a xslt file 115 */ 116 public String getDocbook2outgoingReferencesXSLT() 117 { 118 return _docbook2outgoingReferencesXSLT; 119 } 120 121 /** 122 * Get the component role to use when transforming from docbook to html 123 * @return The component role 124 */ 125 public String getDocbook2HTMLHandler() 126 { 127 return _docbook2HTMLHandler; 128 } 129 130 /** 131 * Get the component role to use when transforming from htmleditor to docbook 132 * @return The component role 133 */ 134 public String getHTMLEditor2DocbookHandler() 135 { 136 return _htmleditor2docbookHandler; 137 } 138 139 /** 140 * Get the component role to use when transforming from docbook to htmleditor 141 * @return The component role 142 */ 143 public String getDocbook2HTMLEditorHandler() 144 { 145 return _docbook2htmleditorHandler; 146 } 147}