Changeset 169:1dcf496aa65c
- Timestamp:
- 09/12/08 18:01:56 (5 years ago)
- Branch:
- default
- convert_revision:
- svn:cdcfb263-7567-472c-a848-e2c2df3466e7/trunk@170
- Files:
-
- 17 modified
-
build-user.xml (modified) (3 diffs)
-
build.xml (modified) (2 diffs)
-
log4j.xml (modified) (14 diffs)
-
org/w3c/unicorn/Framework.java (modified) (3 diffs)
-
org/w3c/unicorn/UnicornCall.java (modified) (6 diffs)
-
org/w3c/unicorn/index/IndexGenerator.java (modified) (2 diffs)
-
org/w3c/unicorn/response/Response.java (modified) (1 diff)
-
org/w3c/unicorn/response/parser/DefaultParser.java (modified) (2 diffs)
-
org/w3c/unicorn/response/parser/ResponseParser.java (modified) (1 diff)
-
org/w3c/unicorn/response/parser/ResponseParserFactory.java (modified) (1 diff)
-
org/w3c/unicorn/tasklist/TaskListUnmarshallerBeans.java (modified) (24 diffs)
-
org/w3c/unicorn/tests/FirstServlet.java (modified) (3 diffs)
-
org/w3c/unicorn/util/Property.java (modified) (2 diffs)
-
org/w3c/unicorn/util/remote-unicorn.properties (modified) (1 diff)
-
org/w3c/unicorn/util/unicorn.properties (modified) (3 diffs)
-
resources/tasklist/new-tasklist.xml (modified) (1 diff)
-
resources/tasklist/tasklist.rdf (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
build-user.xml
r87 r169 7 7 </target> 8 8 9 <target name="remoteConfiguration" description="Workspace configuration for remote">9 <target name="remoteConfiguration" depends="build" description="Workspace configuration for remote"> 10 10 <copy file="./org/w3c/unicorn/util/remote-unicorn.properties" 11 11 tofile="./build/org/w3c/unicorn/util/unicorn.properties" … … 25 25 </target> 26 26 27 <target name="localConfiguration" >27 <target name="localConfiguration" depends="war" > 28 28 <copy file="./org/w3c/unicorn/util/local-unicorn.properties" 29 29 tofile="./build/org/w3c/unicorn/util/unicorn.properties" … … 66 66 </target> 67 67 68 <target name="war" depends="remoteConfiguration,make-war ,localConfiguration" />68 <target name="war" depends="remoteConfiguration,make-war" /> 69 69 70 70 <target name="jar" depends="build" description="Creates the unicorn library"> -
build.xml
r155 r169 15 15 16 16 <path id="project.classpath"> 17 <pathelement location=" build"/>17 <pathelement location="."/> 18 18 <pathelement location="${unicorn.location}/lib/activation.jar"/> 19 19 <pathelement location="${unicorn.location}/lib/commons-collections-3.1.jar"/> … … 62 62 <target name="build" depends="init"> 63 63 <echo message="${ant.project.name}: ${ant.file}"/> 64 <javac destdir=" build">64 <javac destdir="." debug="on" debuglevel="lines,vars,source"> 65 65 <src path="."/> 66 66 <exclude name="lib/"/> -
log4j.xml
r34 r169 16 16 17 17 <appender name="out-level-error-text" class="org.apache.log4j.RollingFileAppender"> 18 <param name="File" value=" D:/w3c/unicorn/logs/error.log" />18 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/level/error.log" /> 19 19 <param name="MaxFileSize" value="1024KB" /> 20 20 <param name="MaxBackupIndex" value="1" /> … … 31 31 32 32 <appender name="out-level-warning-text" class="org.apache.log4j.RollingFileAppender"> 33 <param name="File" value=" D:/w3c/unicorn/logs/warning.log" />33 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/level/warning.log" /> 34 34 <param name="MaxFileSize" value="1024KB" /> 35 35 <param name="MaxBackupIndex" value="1" /> … … 46 46 47 47 <appender name="out-level-info-text" class="org.apache.log4j.RollingFileAppender"> 48 <param name="File" value=" D:/w3c/unicorn/logs/info.log" />48 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/level/info.log" /> 49 49 <param name="MaxFileSize" value="1024KB" /> 50 50 <param name="MaxBackupIndex" value="1" /> … … 61 61 62 62 <appender name="out-level-debug-text" class="org.apache.log4j.RollingFileAppender"> 63 <param name="File" value=" D:/w3c/unicorn/logs/debug.log" />63 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/level/debug.log" /> 64 64 <param name="MaxFileSize" value="1024KB" /> 65 65 <param name="MaxBackupIndex" value="1" /> … … 76 76 77 77 <appender name="out-level-trace-text" class="org.apache.log4j.RollingFileAppender"> 78 <param name="File" value=" D:/w3c/unicorn/logs/trace.log" />78 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/level/trace.log" /> 79 79 <param name="MaxFileSize" value="1024KB" /> 80 80 <param name="MaxBackupIndex" value="1" /> … … 95 95 96 96 <appender name="out-package-contract-text" class="org.apache.log4j.RollingFileAppender"> 97 <param name="File" value=" D:/w3c/unicorn/logs/contract.log" />97 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/package/contract.log" /> 98 98 <param name="MaxFileSize" value="1024KB" /> 99 99 <param name="MaxBackupIndex" value="1" /> … … 105 105 106 106 <appender name="out-package-index-text" class="org.apache.log4j.RollingFileAppender"> 107 <param name="File" value=" D:/w3c/unicorn/logs/index.log" />107 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/package/index.log" /> 108 108 <param name="MaxFileSize" value="1024KB" /> 109 109 <param name="MaxBackupIndex" value="1" /> … … 115 115 116 116 <appender name="out-package-input-text" class="org.apache.log4j.RollingFileAppender"> 117 <param name="File" value=" D:/w3c/unicorn/logs/input.log" />117 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/package/input.log" /> 118 118 <param name="MaxFileSize" value="1024KB" /> 119 119 <param name="MaxBackupIndex" value="1" /> … … 125 125 126 126 <appender name="out-package-output-text" class="org.apache.log4j.RollingFileAppender"> 127 <param name="File" value=" D:/w3c/unicorn/logs/output.log" />127 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/package/output.log" /> 128 128 <param name="MaxFileSize" value="1024KB" /> 129 129 <param name="MaxBackupIndex" value="1" /> … … 135 135 136 136 <appender name="out-package-request-text" class="org.apache.log4j.RollingFileAppender"> 137 <param name="File" value=" D:/w3c/unicorn/logs/request.log" />137 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/package/request.log" /> 138 138 <param name="MaxFileSize" value="1024KB" /> 139 139 <param name="MaxBackupIndex" value="1" /> … … 145 145 146 146 <appender name="out-package-servlet-text" class="org.apache.log4j.RollingFileAppender"> 147 <param name="File" value=" D:/w3c/unicorn/logs/servlet.log" />147 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/package/servlet.log" /> 148 148 <param name="MaxFileSize" value="1024KB" /> 149 149 <param name="MaxBackupIndex" value="1" /> … … 155 155 156 156 <appender name="out-package-tasklist-text" class="org.apache.log4j.RollingFileAppender"> 157 <param name="File" value=" D:/w3c/unicorn/logs/tasklist.log" />157 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/package/tasklist.log" /> 158 158 <param name="MaxFileSize" value="1024KB" /> 159 159 <param name="MaxBackupIndex" value="1" /> … … 165 165 166 166 <appender name="out-package-util-text" class="org.apache.log4j.RollingFileAppender"> 167 <param name="File" value=" D:/w3c/unicorn/logs/util.log" />167 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/package/util.log" /> 168 168 <param name="MaxFileSize" value="1024KB" /> 169 169 <param name="MaxBackupIndex" value="1" /> … … 175 175 176 176 <appender name="out-package-unicorn-text" class="org.apache.log4j.RollingFileAppender"> 177 <param name="File" value=" D:/w3c/unicorn/logs/all.log" />177 <param name="File" value="/opt/Jigsaw/Jigsaw/WWW/unicorn/logs/all.log" /> 178 178 <param name="MaxFileSize" value="1024KB" /> 179 179 <param name="MaxBackupIndex" value="1" /> -
org/w3c/unicorn/Framework.java
r160 r169 1 // $Id: Framework.java,v 1.1 5 2008-09-08 13:43:47 jbarouhExp $1 // $Id: Framework.java,v 1.16 2008-09-12 18:01:51 jean-gui Exp $ 2 2 // Author: Damien LEROY. 3 3 // (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. … … 135 135 // Add all observer contract 136 136 final BufferedReader aBufferedReader; 137 137 138 aBufferedReader = new BufferedReader(new FileReader(Property 138 139 .get("OBSERVER_LIST_FILE"))); … … 210 211 try { 211 212 // parse all the task files 212 213 213 final File[] tFileXML = ListFiles.listFiles(Property 214 214 .get("PATH_TO_TASKLIST"), "\\.xml"); -
org/w3c/unicorn/UnicornCall.java
r167 r169 1 // $Id: UnicornCall.java,v 1.2 0 2008-09-09 10:16:16 jbarouhExp $1 // $Id: UnicornCall.java,v 1.21 2008-09-12 18:01:51 jean-gui Exp $ 2 2 // Author: Jean-Guilhem Rouel 3 3 // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. … … 6 6 7 7 import java.io.IOException; 8 import java.io.InputStreamReader; 9 8 10 import java.net.MalformedURLException; 9 11 import java.net.URL; 12 10 13 import java.util.ArrayList; 11 14 import java.util.LinkedHashMap; … … 14 17 15 18 import javax.activation.MimeType; 19 16 20 import javax.xml.parsers.DocumentBuilder; 17 21 import javax.xml.parsers.DocumentBuilderFactory; … … 23 27 import org.apache.commons.fileupload.FileItem; 24 28 import org.apache.commons.logging.Log; 29 25 30 import org.w3c.dom.Document; 31 26 32 import org.w3c.unicorn.contract.CallParameter; 27 33 import org.w3c.unicorn.contract.EnumInputMethod; … … 763 769 UnicornCall.logger.trace("condId : " + cond.getId()); 764 770 UnicornCall.logger.trace("condType : " + cond.getType()); 765 UnicornCall.logger.trace("condObserver : " + cond.getObserver().getID());766 771 UnicornCall.logger.trace("condValue : " + cond.getValue()); 772 767 773 boolean passed = false; 768 Response res = mapOfResponse.get(cond.getObserver().getID()); 769 770 // Testing if there is a matching response in the map 771 // and if it is passed 772 if (res != null && res.isPassed()) { 773 774 if (cond.getType().equals(EnumCondType.MIMETYPE)) { 774 775 if (cond.getType().equals(EnumCondType.MIMETYPE)) { 775 776 passed = cond.getValue().equals(getMimeType().toString()); 776 } 777 778 else if (cond.getType().equals(EnumCondType.XPATH)) { 779 780 String xmlStr = res.getXml().toString(); 781 782 DocumentBuilderFactory xmlFact = DocumentBuilderFactory 783 .newInstance(); 784 785 // namespace awareness is escaped since we don't use it 786 // for the moment 787 xmlFact.setNamespaceAware(false); 788 789 DocumentBuilder builder = xmlFact.newDocumentBuilder(); 790 791 Document doc = builder.parse(new java.io.ByteArrayInputStream( 792 xmlStr.getBytes())); 793 794 String xpathStr = cond.getValue(); 795 796 XPathFactory xpathFact = new XPathFactoryImpl(); 797 798 XPath xpath = xpathFact.newXPath(); 799 XPathExpression xpe = xpath.compile(xpathStr); 800 passed = (Boolean) xpe.evaluate(doc, XPathConstants.BOOLEAN); 801 802 } 803 804 } 777 } 778 else if (cond.getType().equals(EnumCondType.XPATH)) { 779 UnicornCall.logger.trace("condObserver : " + cond.getObserver().getID()); 780 Response res = mapOfResponse.get(cond.getObserver().getID()); 781 // Testing if there is a matching response in the map 782 // and if it is passed 783 if (res != null) { 784 String xmlStr = res.getXml().toString(); 785 786 DocumentBuilderFactory xmlFact = DocumentBuilderFactory 787 .newInstance(); 788 789 // namespace awareness is escaped since we don't use it 790 // for the moment 791 xmlFact.setNamespaceAware(false); 792 793 DocumentBuilder builder = xmlFact.newDocumentBuilder(); 794 795 Document doc = builder.parse(new java.io.ByteArrayInputStream( 796 xmlStr.getBytes())); 797 798 String xpathStr = cond.getValue(); 799 800 XPathFactory xpathFact = new XPathFactoryImpl(); 801 802 XPath xpath = xpathFact.newXPath(); 803 XPathExpression xpe = xpath.compile(xpathStr); 804 passed = (Boolean) xpe.evaluate(doc, XPathConstants.BOOLEAN); 805 } 806 } 805 807 806 808 cond.setResult(passed); … … 938 940 e.printStackTrace(); 939 941 try { 940 aResponse = ResponseParserFactory.parse((new URL("file:" 941 + Property.get("PATH_TO_ERROR_TEMPLATES") 942 + "en_io_error.vm")).openConnection().getInputStream(), 943 aRequest.getResponseType()); 942 StringBuilder builder = new StringBuilder(); 943 // TODO should be first processed as a template 944 InputStreamReader isr = new InputStreamReader(new URL("file:" 945 + Property.get("PATH_TO_ERROR_TEMPLATES") 946 + "en_io_error.vm").openConnection().getInputStream()); 947 char[] chararray = new char[8192]; 948 int readLength = 0; 949 while((readLength = isr.read(chararray, 0, 8192)) > -1) { 950 builder.append(chararray, 0, readLength); 951 } 952 953 aResponse = ResponseParserFactory.parse(builder.toString(), 954 this.aRequest.getResponseType()); 955 aResponse.setXml(builder); 944 956 } catch (MalformedURLException e1) { 945 957 e1.printStackTrace(); -
org/w3c/unicorn/index/IndexGenerator.java
r148 r169 1 // $Id: IndexGenerator.java,v 1. 4 2008-09-02 13:22:16 fbatardExp $1 // $Id: IndexGenerator.java,v 1.5 2008-09-12 18:01:51 jean-gui Exp $ 2 2 // Author: Jean-Guilhem Rouel 3 3 // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. … … 107 107 ParseErrorException, Exception { 108 108 IndexGenerator.logger.trace("generateIndexes"); 109 110 109 final File[] tFile = ListFiles.listFiles(Property 111 110 .get("PATH_TO_INDEX_TEMPLATES"), "\\.vm$"); -
org/w3c/unicorn/response/Response.java
r168 r169 20 20 */ 21 21 protected Map<String, Map<String, Result>> mapOfLangURIResult = new LinkedHashMap<String, Map<String,Result>>(); 22 22 23 23 /** 24 24 * Gets the value of the uri property. -
org/w3c/unicorn/response/parser/DefaultParser.java
r168 r169 28 28 import org.w3c.unicorn.response.Warning; 29 29 import org.w3c.unicorn.util.LocalizedString; 30 import java.io.*;31 30 32 31 /** … … 37 36 protected static final Log logger = LogFactory 38 37 .getLog("org.w3c.unicorn.response.parser.DefaultParser"); 39 40 /**41 * Parses the input and returns the response.42 * @param inputStream The input stream.43 * @return The corresponding response.44 */45 public Response parse(InputStream inputStream) {46 try {47 org.w3.unicorn.observationresponse.ObservationresponseDocument ord = org.w3.unicorn.observationresponse.ObservationresponseDocument.Factory.parse(inputStream);48 return swap(ord);49 } catch (XmlException e) {50 e.printStackTrace();51 logger.error("XMLBeansException : " + e.getMessage(), e);52 return null;53 } catch (IOException e) {54 e.printStackTrace();55 logger.error("XMLBeansException : " + e.getMessage(), e);56 return null;57 }58 59 }60 38 61 39 /** -
org/w3c/unicorn/response/parser/ResponseParser.java
r168 r169 6 6 7 7 public interface ResponseParser { 8 public Response parse(InputStream inputStream);9 8 public Response parse(String r); 10 9 } -
org/w3c/unicorn/response/parser/ResponseParserFactory.java
r168 r169 32 32 33 33 /** 34 * Parses the input stream thanks to a response parseand34 * Parses the string thanks to a response parser and 35 35 * returns the response. 36 * @param is The input stream.36 * @param r the string 37 37 * @param responseType The type of the response. 38 38 * @return The response parsed corresponding to the input. 39 39 */ 40 public static Response parse(InputStream is, String responseType) {41 try {42 Response response = createResponseParser(responseType).parse(is);43 return response;44 } catch (SAXException e) {45 e.printStackTrace();46 } catch (ParserConfigurationException e) {47 e.printStackTrace();48 } catch (IOException e) {49 e.printStackTrace();50 }51 return null;52 }53 54 40 public static Response parse(String r, String responseType) { 55 41 try { -
org/w3c/unicorn/tasklist/TaskListUnmarshallerBeans.java
r164 r169 44 44 /** 45 45 * Unmarshals the tasklist thanks to the XMLBeans tools. 46 * 46 * 47 47 * @author Florent Batard, Jonathan Barouh 48 * 48 * 49 49 */ 50 50 public class TaskListUnmarshallerBeans implements TasksListUnmarshaller { 51 51 52 private TasklistDocument aTaskList; 53 52 private TasklistDocument aTaskList; 53 54 54 private static final Log logger = LogFactory.getLog("org.w3c.unicorn.tasklist"); 55 55 56 56 private int NodeID=0; 57 57 58 58 59 59 /** 60 60 * The tasklist corresponding to the xml file 61 61 */ 62 62 private Map<String,Task> mapOfTask; 63 63 64 64 /** 65 65 * The observers' list used to check some constraints on the tasks 66 66 */ 67 67 private Map<String, Observer> mapOfObserver; 68 69 68 69 70 70 public TaskListUnmarshallerBeans(){} 71 71 72 72 public TaskListUnmarshallerBeans(final Map<String, Observer> mapOfObserver) { 73 TaskListUnmarshallerBeans.logger.trace("Constructor"); 73 TaskListUnmarshallerBeans.logger.trace("Constructor"); 74 74 this.mapOfTask = new LinkedHashMap<String, org.w3c.unicorn.tasklist.Task>(); 75 75 this.mapOfObserver = mapOfObserver; 76 76 } 77 78 79 77 78 79 80 80 private void addTask(final TaskType aTask) throws ParameterException { 81 81 TaskListUnmarshallerBeans.logger.trace("addTask"); 82 82 83 83 if (aTask == null) { 84 84 TaskListUnmarshallerBeans.logger.warn("Task : null"); 85 85 return; 86 86 } 87 87 88 88 if (TaskListUnmarshallerBeans.logger.isDebugEnabled()) { 89 89 TaskListUnmarshallerBeans.logger.trace("Add task : " + aTask.getId()); 90 90 } 91 91 92 92 final Task aTaskCurrent = new Task(); 93 93 // Create the execution level tree 94 94 aTaskCurrent.setID(aTask.getId()); 95 95 aTaskCurrent.setTree(this.ExpandTree(aTask)); 96 96 97 97 // parameters 98 98 final ParametersType aParameters = aTask.getParameters(); 99 99 if (aParameters != null) { 100 100 final ParameterType[] listOfParameter; 101 listOfParameter = aParameters.getParameterArray(); 102 101 listOfParameter = aParameters.getParameterArray(); 102 103 103 for (final ParameterType aParameterBeans : listOfParameter) { 104 104 105 105 final TUi.Enum aTUi = aParameterBeans.getUi(); 106 106 final String sObserver = aParameterBeans.getObserver(); 107 107 final String sName = aParameterBeans.getName(); 108 108 109 109 // default values as string 110 110 final String sDefaultValues = aParameterBeans.getDefault(); 111 112 final TParamType.Enum aParamType = aParameterBeans.getType(); 113 114 Parameter aParameter = null; 115 111 112 final TParamType.Enum aParamType = aParameterBeans.getType(); 113 114 Parameter aParameter = null; 115 116 116 if (sObserver != null && !"".equals(sObserver)) { 117 117 aParameter = getParameterFromObserver( … … 120 120 aTUi, 121 121 sDefaultValues, 122 aParamType); 123 } 122 aParamType); 123 } 124 124 else { 125 125 126 126 // Values 127 127 final Map<String, Value> mapOfValue = new LinkedHashMap<String, Value>(); 128 for (final ValueType aValue : 128 for (final ValueType aValue : 129 129 aParameterBeans.getValueArray()) { 130 130 131 131 // name of the value 132 132 String sValueName = aValue.getName(); … … 134 134 sValueName = ""; 135 135 } 136 136 137 137 // Mappings of the value 138 138 final Map<String, List<Mapping>> mapOfMapping = new LinkedHashMap<String, List<Mapping>>(); … … 155 155 sValueName)); 156 156 } 157 157 158 158 aParameter = this.createParameter( 159 159 aParamType, 160 160 sName, 161 161 aTUi, 162 sDefaultValues, 162 sDefaultValues, 163 163 mapOfValue); 164 164 } 165 166 if (aParameter != null) { 165 166 if (aParameter != null) { 167 167 aTaskCurrent.addParameter(aParameter); 168 168 } … … 173 173 174 174 } 175 176 175 176 177 177 /** 178 178 * Creates a usable mapping from a JAXB-generated one. … … 195 195 196 196 // the mapped parameter 197 final String sMappingParam = aMapped.getParam(); 197 final String sMappingParam = aMapped.getParam(); 198 198 // the value mapped 199 199 String sMappingValue = aMapped.getValue(); … … 201 201 sMappingValue = ""; 202 202 } 203 203 204 204 // TODO check if is useful to add input method in mapping 205 205 final List<EnumInputMethod> listOfEnumInputMethod = new ArrayList<EnumInputMethod>(); 206 206 207 207 // The list of mapped input methods 208 209 final List<TInputMethod.Enum> listOfTInputMethodBeans = 210 new ArrayList<TInputMethod.Enum>(); 208 209 final List<TInputMethod.Enum> listOfTInputMethodBeans = 210 new ArrayList<TInputMethod.Enum>(); 211 211 for (Object methodString : aMapped.getInputmethod()) { 212 212 listOfTInputMethodBeans.add( … … 219 219 listOfTInputMethodBeans.add(TInputMethod.URI); 220 220 } 221 221 222 222 /* 223 223 * For each input method, we check that the mapped observer: 224 224 * - can handle this input method 225 * - has a parameter with the corresponding name for this input 225 * - has a parameter with the corresponding name for this input 226 226 * method 227 * - can handle this value for this parameter 227 * - can handle this value for this parameter 228 228 */ 229 229 … … 234 234 if (aObserverMapped.getInputMethod(aEnumInputMethod) == null) { 235 235 TaskListUnmarshallerBeans.logger.warn( 236 sMappingObserver + " does not support " + 236 sMappingObserver + " does not support " + 237 237 aEnumInputMethod.value() + " input method."); 238 238 continue; 239 239 } 240 240 final CallParameter aCallParameterMapped; 241 aCallParameterMapped = aObserverMapped.getInputMethod(aEnumInputMethod).getCallParameterByName(sMappingParam); 241 aCallParameterMapped = aObserverMapped.getInputMethod(aEnumInputMethod).getCallParameterByName(sMappingParam); 242 242 // the parameter exists 243 243 if (aCallParameterMapped == null) { … … 250 250 if (!aCallParameterMapped.contains(sMappingValue)) { 251 251 TaskListUnmarshallerBeans.logger.error( 252 "Parameter " + sMappingParam + 252 "Parameter " + sMappingParam + 253 253 " does not accept " + sMappingValue + 254 254 " as a value."); … … 257 257 listOfEnumInputMethod.add(aEnumInputMethod); 258 258 } 259 259 260 260 if (listOfEnumInputMethod.size() == 0) { 261 261 return null; 262 262 } 263 263 264 264 return new Mapping( 265 265 aObserverMapped, 266 266 sMappingParam, 267 sMappingValue/*, 267 sMappingValue/*, 268 268 listOfEnumInputMethod*/); 269 269 } 270 271 270 271 272 272 private Parameter getParameterFromObserver ( 273 273 final String sParamName, … … 284 284 TaskListUnmarshallerBeans.logger.debug("TParamType : "+aTParamType+"."); 285 285 } 286 286 287 287 final Observer aObserver = this.mapOfObserver.get(sObserverName); 288 288 289 289 // does the requested observer exist? 290 290 if (aObserver == null) { … … 294 294 return null; 295 295 } 296 296 297 297 // the name of the parameter 298 298 // TODO Change when the RDF is done 299 299 final LocalizedString aLocalizedString = new LocalizedString(); 300 aLocalizedString.addLocalization("en", sParamName); 301 300 aLocalizedString.addLocalization("en", sParamName); 301 302 302 final Map<String, Value> mapOfValue = new LinkedHashMap<String, Value>(); 303 303 304 304 // iterate over the observer's methods 305 305 final Map<EnumInputMethod, InputMethod> mapOfInputMethod = aObserver.getMapOfInputMethod(); 306 306 for (final EnumInputMethod aEnumInputMethod : mapOfInputMethod.keySet()) { 307 final InputMethod aInputMethod = mapOfInputMethod.get(aEnumInputMethod); 308 307 final InputMethod aInputMethod = mapOfInputMethod.get(aEnumInputMethod); 308 309 309 if (aInputMethod.getCallParameter().getName().equals(sParamName)) { 310 // the referenced parameter is an input one for the current 310 // the referenced parameter is an input one for the current 311 311 // method, so it must be ignored 312 312 TaskListUnmarshallerBeans.logger.info( 313 313 "The referenced parameter is an input one for the current method, so it must be ignored."); 314 314 continue; 315 } 316 315 } 316 317 317 final CallMethod aCallMethod = aInputMethod.getCallMethod(); 318 final CallParameter aCallParameter = aCallMethod.getCallParameterByName(sParamName); 319 // A parameter with this name exists for this method 318 final CallParameter aCallParameter = aCallMethod.getCallParameterByName(sParamName); 319 // A parameter with this name exists for this method 320 320 if (aCallParameter != null) { 321 321 for (final String sValue : aCallParameter.getListOfPossibleValue()) { … … 324 324 // the newly created parameter already contains a 325 325 // similar value 326 327 // we know that the created parameter contains exactly 326 327 // we know that the created parameter contains exactly 328 328 // ONE mapping for this value 329 329 //aValueCurrent.getMappings().get(sObserverName).get(0).addInputMethod(aEnumInputMethod); … … 336 336 // TODO Add localized names in RDF contract 337 337 aInternationalizedMessageValueName.addLocalization("en", sValue); 338 338 339 339 final List<EnumInputMethod> mapOfNewInputMethod = new ArrayList<EnumInputMethod>(); 340 340 mapOfNewInputMethod.add(aEnumInputMethod); 341 341 final Mapping aMapping = new Mapping( 342 342 aObserver, 343 sParamName, 343 sParamName, 344 344 sValue); 345 345 … … 357 357 mapOfValue.put(sValue, aValueToAdd); 358 358 } 359 } 359 } 360 360 } 361 361 } … … 364 364 sParamName, 365 365 aTUi, 366 sDefaultValues, 367 mapOfValue); 368 } 369 370 366 sDefaultValues, 367 mapOfValue); 368 } 369 370 371 371 /** 372 372 * Create the tree from a TaskType element 373 * 373 * 374 374 * @param myTask 375 375 * the task to transform into a tree … … 393 393 /** 394 394 * Recursion over the Then tag to fill the tree 395 * 395 * 396 396 * @param myThen 397 397 * the ThenType node for the recursion … … 415 415 /** 416 416 * Created the Ifnode in the tree 417 * 417 * 418 418 * @param ifs 419 419 * the IfType node template to create the Ifnode … … 461 461 return ifnode; 462 462 } 463 464 465 466 463 464 465 466 467 467 private org.w3c.unicorn.tasklist.parameters.Parameter createParameter ( 468 468 final TParamType.Enum aTParamType, … … 490 490 return aParameter; 491 491 } 492 493 492 493 494 494 /** 495 495 * Wraps a TInputMethod instance on an EnumInputMethod … … 507 507 default: 508 508 return EnumInputMethod.URI; 509 } 510 } 511 512 513 509 } 510 } 511 512 513 514 514 public Map<String, org.w3c.unicorn.tasklist.Task> getMapOfTask() { 515 515 TaskListUnmarshallerBeans.logger.trace("getMapOfTask"); … … 524 524 525 525 try { 526 this.aTaskList = TasklistDocument.Factory.parse(aURL.openStream()); 526 ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 527 this.aTaskList = TasklistDocument.Factory.parse(aURL.openStream()); 527 528 } catch (XmlException e) { 528 529 TaskListUnmarshallerBeans.logger.error("Parsing error in TasklistUnmarshaller",e); 529 530 e.printStackTrace(); 530 } 531 } 532 533 531 } 532 } 533 534 534 535 535 536 public void unmarshal() throws Exception { … … 543 544 } 544 545 } 545 546 546 547 // computes and replaces references by their corresponding observations 547 548 // and parameters -
org/w3c/unicorn/tests/FirstServlet.java
r102 r169 1 // $Id: FirstServlet.java,v 1.1 1 2008-07-02 17:34:47jean-gui Exp $1 // $Id: FirstServlet.java,v 1.12 2008-09-12 18:01:51 jean-gui Exp $ 2 2 // Author: Jean-Guilhem Rouel 3 3 // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. … … 64 64 public void init (final ServletConfig aServletConfig) throws ServletException { 65 65 FirstServlet.logger.trace("init"); 66 // UNICORN_HOME is not set by the properties file, so we try to get it 67 // from the servlet 68 //if(props.getProperty("UNICORN_HOME") == null) { 69 String sPathToServlet = aServletConfig.getServletContext().getRealPath("/") + "/"; 70 // Hack for Jigsaw 71 if ("jigsaw".equals(Property.get("SERVER_TYPE"))) { 72 sPathToServlet += aServletConfig.getServletName() + "/"; 73 } 74 /* // TODO replace by org.w3c.unicorn.util.Property 75 if (Configuration.get("SERVER_TYPE").equals("jigsaw")) { 76 sPathToServlet += aServletConfig.getServletName() + "/"; 77 } 78 */ 79 final Property aProperty = Property.getProperty("UNICORN_HOME"); 80 aProperty.clear(); 81 aProperty.setSpecific(sPathToServlet); 82 83 /*// TODO change to use util.Property 84 for (final String sProp : Configuration.getConfiguration()) { 85 FirstServlet.logger.debug("Property : "+sProp+"."); 86 }*/ 87 66 88 67 FirstServlet.factory.setRepository( 89 68 new File(Property.get("UPLOADED_FILES_REPOSITORY"))); 69 90 70 try { 91 IndexGenerator.generateIndexes();71 IndexGenerator.generateIndexes(); 92 72 } 93 73 catch (final ResourceNotFoundException e) { … … 104 84 } 105 85 FirstServlet.logger.info("End of initialisation of servlet."); 86 106 87 } 107 88 -
org/w3c/unicorn/util/Property.java
r89 r169 1 // $Id: Property.java,v 1. 3 2008-06-17 13:45:31 jbarouhExp $1 // $Id: Property.java,v 1.4 2008-09-12 18:01:51 jean-gui Exp $ 2 2 // Author: Damien LEROY. 3 3 // (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. … … 118 118 break; 119 119 } 120 } 120 } 121 121 Property.addProperty(aProperty); 122 122 } -
org/w3c/unicorn/util/remote-unicorn.properties
r81 r169 36 36 TEMPLATE_FILE_EXTENSION = .vm 37 37 38 UPLOADED_FILES_REPOSITORY = $UNICORN_HOME , WEB-INF/uploaded-files/38 UPLOADED_FILES_REPOSITORY = $UNICORN_HOME , uploaded-files/ 39 39 DELETE_UPLOADED_FILES = true 40 40 -
org/w3c/unicorn/util/unicorn.properties
r148 r169 1 1 2 2 UNICORN_URL = http://localhost:8080/unicorn 3 UNICORN_HOME = / var/lib/tomcat5.5/webapps/unicorn/3 UNICORN_HOME = /opt/Jigsaw/Jigsaw/WWW/unicorn/ 4 4 UNICORN_ENCODING = UTF-8 5 5 … … 11 11 FILESYSTEM_PREFIX = file: 12 12 13 SERVER_TYPE = tomcat13 SERVER_TYPE = jigsaw 14 14 15 PATH_TO_RESOURCES = $UNICORN_HOME , WEB-INF/resources/15 PATH_TO_RESOURCES = $UNICORN_HOME , resources/ 16 16 PATH_TO_OBSERVER_LIST = $PATH_TO_RESOURCES 17 17 PATH_TO_TASKLIST = $PATH_TO_RESOURCES , tasklist/ … … 39 39 TEMPLATE_FILE_EXTENSION = .vm 40 40 41 UPLOADED_FILES_REPOSITORY = $UNICORN_HOME , WEB-INF/uploaded-files/41 UPLOADED_FILES_REPOSITORY = $UNICORN_HOME , uploaded-files/ 42 42 DELETE_UPLOADED_FILES = true 43 43 -
resources/tasklist/new-tasklist.xml
r165 r169 5 5 6 6 <task id="conformance"> 7 8 <routine ref="conformance"> 9 <exec id="appc-check" value="appc-checker" type="observation"/> 10 <exec id="markup_and_css" value="markup_and_css" type="subtask"/> 11 </routine> 12 7 8 <conds> 9 <cond id="markup-valid" result="passed" observer="markup-validator" type="xpath"> 10 <value>//passed = 'true'</value> 11 </cond> 12 13 <cond id="is-html" result="passed" type="mimetype"> 14 <value>text/html</value> 15 </cond> 16 <cond id="is-css" result="passed" type="mimetype"> 17 <value>text/css</value> 18 </cond> 19 </conds> 20 <!-- 21 <cond id="mathml" result="passed" type="mimetype"> 22 <value>application/mathml+xml</value> 23 </cond> 24 <cond id="smil" result="passed" type="mimetype"> 25 <value>application/smil+xml</value> 26 </cond> 27 28 <cond id="svg" result="passed" type="mimetype"> 29 <value>image/svg+xml</value> 30 </cond> 31 <cond id="xhtml" result="passed" type="mimetype"> 32 <value>application/xhtml+xml</value> 33 </cond> 34 --> 35 36 <routine> 37 <if test="is-css"> 38 <then> 39 <exec id="css" value="css-validator" type="observation"/> 40 </then> 41 <else> 42 <exec id="markup" value="markup-validator" type="observation"/> 43 <if test="markup-valid"> 44 <then> 45 <if test="is-html"> 46 <then> 47 <exec id="appc" value="appc-checker" type="observation"/> 48 </then> 49 </if> 50 <exec id="css" value="css-validator" type="observation"/> 51 </then> 52 </if> 53 </else> 54 </if> 55 </routine> 56 13 57 <outputseq> 14 58 <outputgroup id="1"> 15 <tasksort>appc-checker</tasksort> 59 <tasksort>markup</tasksort> 60 <tasksort>appc</tasksort> 61 </outputgroup> 62 <outputgroup id="2"> 63 <tasksort>css</tasksort> 16 64 </outputgroup> 17 65 </outputseq> 18 66 19 67 20 </task> 21 22 23 24 <task id="markup_and_css"> 25 26 <conds> 27 28 <cond id="xpath" result="passed" observer="markup-validator" type="xpath"> 29 <value>//result</value> 30 </cond> 31 32 <cond id="mathml" result="passed" type="mimetype"> 33 <value>application/mathml+xml</value> 34 </cond> 35 <cond id="smil" result="passed" type="mimetype"> 36 <value>application/smil+xml</value> 37 </cond> 38 39 <cond id="html" result="passed" type="mimetype"> 40 <value>text/html</value> 41 </cond> 42 <cond id="css" result="passed" type="mimetype"> 43 <value>text/css</value> 44 </cond> 45 <cond id="svg" result="passed" type="mimetype"> 46 <value>image/svg+xml</value> 47 </cond> 48 <cond id="xhtml" result="passed" type="mimetype"> 49 <value>application/xhtml+xml</value> 50 </cond> 51 </conds> 52 53 <routine ref="markup_and_css"> 54 <exec id="markup" value="markup-validator" type="observation" > 55 </exec> 56 57 <if test ="xpath"> 58 <then> 59 <exec id="css" value="css-validator" type="observation" > 60 </exec> 61 </then> 62 </if> 63 64 </routine> 65 66 <outputseq> 67 <outputgroup id="2"> 68 <tasksort>css-validator</tasksort> 69 <tasksort>markup-validator</tasksort> 70 </outputgroup> 71 </outputseq> 72 73 74 </task> 75 76 77 78 68 </task> 79 69 80 70 </tasklist> -
resources/tasklist/tasklist.rdf
r165 r169 25 25 26 26 </ucn:Task> 27 28 <ucn:Task ucn:reference="markup_and_css">29 <ucn:longName xml:lang="en">Markup and CSS Check</ucn:longName>30 <ucn:longName xml:lang="fr">Vérifie la conformité Markup et CSS</ucn:longName>31 <ucn:description xml:lang="en">This task will do Markup and CSS observations.</ucn:description>32 33 </ucn:Task>34 35 27 36 28 </rdf:RDF>
