Changeset 169:1dcf496aa65c

Show
Ignore:
Timestamp:
09/12/08 18:01:56 (5 years ago)
Author:
jean-gui
Branch:
default
convert_revision:
svn:cdcfb263-7567-472c-a848-e2c2df3466e7/trunk@170
Message:

first version that works with Jigsaw + fixed a bug in cond handling + removed parse(InputStream?)

Files:
17 modified

Legend:

Unmodified
Added
Removed
  • build-user.xml

    r87 r169  
    77</target> 
    88 
    9 <target name="remoteConfiguration" description="Workspace configuration for remote"> 
     9<target name="remoteConfiguration"  depends="build" description="Workspace configuration for remote"> 
    1010        <copy file="./org/w3c/unicorn/util/remote-unicorn.properties" 
    1111        tofile="./build/org/w3c/unicorn/util/unicorn.properties" 
     
    2525</target> 
    2626 
    27 <target name="localConfiguration" > 
     27<target name="localConfiguration" depends="war" > 
    2828        <copy file="./org/w3c/unicorn/util/local-unicorn.properties"  
    2929        tofile="./build/org/w3c/unicorn/util/unicorn.properties" 
     
    6666</target> 
    6767 
    68 <target name="war" depends="remoteConfiguration,make-war,localConfiguration" /> 
     68<target name="war" depends="remoteConfiguration,make-war" /> 
    6969 
    7070<target name="jar" depends="build" description="Creates the unicorn library"> 
  • build.xml

    r155 r169  
    1515         
    1616    <path id="project.classpath"> 
    17         <pathelement location="build"/> 
     17        <pathelement location="."/> 
    1818        <pathelement location="${unicorn.location}/lib/activation.jar"/> 
    1919        <pathelement location="${unicorn.location}/lib/commons-collections-3.1.jar"/> 
     
    6262    <target name="build" depends="init"> 
    6363        <echo message="${ant.project.name}: ${ant.file}"/> 
    64         <javac destdir="build"> 
     64        <javac destdir="." debug="on" debuglevel="lines,vars,source"> 
    6565            <src path="."/> 
    6666            <exclude name="lib/"/> 
  • log4j.xml

    r34 r169  
    1616 
    1717        <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" /> 
    1919                <param name="MaxFileSize" value="1024KB" /> 
    2020                <param name="MaxBackupIndex" value="1" /> 
     
    3131 
    3232        <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" /> 
    3434                <param name="MaxFileSize" value="1024KB" /> 
    3535                <param name="MaxBackupIndex" value="1" /> 
     
    4646 
    4747        <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" /> 
    4949                <param name="MaxFileSize" value="1024KB" /> 
    5050                <param name="MaxBackupIndex" value="1" /> 
     
    6161 
    6262        <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" /> 
    6464                <param name="MaxFileSize" value="1024KB" /> 
    6565                <param name="MaxBackupIndex" value="1" /> 
     
    7676 
    7777        <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" /> 
    7979                <param name="MaxFileSize" value="1024KB" /> 
    8080                <param name="MaxBackupIndex" value="1" /> 
     
    9595 
    9696        <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" /> 
    9898                <param name="MaxFileSize" value="1024KB" /> 
    9999                <param name="MaxBackupIndex" value="1" /> 
     
    105105 
    106106        <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" /> 
    108108                <param name="MaxFileSize" value="1024KB" /> 
    109109                <param name="MaxBackupIndex" value="1" /> 
     
    115115 
    116116        <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" /> 
    118118                <param name="MaxFileSize" value="1024KB" /> 
    119119                <param name="MaxBackupIndex" value="1" /> 
     
    125125 
    126126        <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" /> 
    128128                <param name="MaxFileSize" value="1024KB" /> 
    129129                <param name="MaxBackupIndex" value="1" /> 
     
    135135 
    136136        <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" /> 
    138138                <param name="MaxFileSize" value="1024KB" /> 
    139139                <param name="MaxBackupIndex" value="1" /> 
     
    145145 
    146146        <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" /> 
    148148                <param name="MaxFileSize" value="1024KB" /> 
    149149                <param name="MaxBackupIndex" value="1" /> 
     
    155155 
    156156        <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" /> 
    158158                <param name="MaxFileSize" value="1024KB" /> 
    159159                <param name="MaxBackupIndex" value="1" /> 
     
    165165 
    166166        <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" /> 
    168168                <param name="MaxFileSize" value="1024KB" /> 
    169169                <param name="MaxBackupIndex" value="1" /> 
     
    175175 
    176176        <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" /> 
    178178                <param name="MaxFileSize" value="1024KB" /> 
    179179                <param name="MaxBackupIndex" value="1" /> 
  • org/w3c/unicorn/Framework.java

    r160 r169  
    1 // $Id: Framework.java,v 1.15 2008-09-08 13:43:47 jbarouh Exp $ 
     1// $Id: Framework.java,v 1.16 2008-09-12 18:01:51 jean-gui Exp $ 
    22// Author: Damien LEROY. 
    33// (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. 
     
    135135                        // Add all observer contract 
    136136                        final BufferedReader aBufferedReader; 
     137       
    137138                        aBufferedReader = new BufferedReader(new FileReader(Property 
    138139                                        .get("OBSERVER_LIST_FILE"))); 
     
    210211                try { 
    211212                        // parse all the task files 
    212  
    213213                        final File[] tFileXML = ListFiles.listFiles(Property 
    214214                                        .get("PATH_TO_TASKLIST"), "\\.xml"); 
  • org/w3c/unicorn/UnicornCall.java

    r167 r169  
    1 // $Id: UnicornCall.java,v 1.20 2008-09-09 10:16:16 jbarouh Exp $ 
     1// $Id: UnicornCall.java,v 1.21 2008-09-12 18:01:51 jean-gui Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    66 
    77import java.io.IOException; 
     8import java.io.InputStreamReader; 
     9 
    810import java.net.MalformedURLException; 
    911import java.net.URL; 
     12 
    1013import java.util.ArrayList; 
    1114import java.util.LinkedHashMap; 
     
    1417 
    1518import javax.activation.MimeType; 
     19 
    1620import javax.xml.parsers.DocumentBuilder; 
    1721import javax.xml.parsers.DocumentBuilderFactory; 
     
    2327import org.apache.commons.fileupload.FileItem; 
    2428import org.apache.commons.logging.Log; 
     29 
    2530import org.w3c.dom.Document; 
     31 
    2632import org.w3c.unicorn.contract.CallParameter; 
    2733import org.w3c.unicorn.contract.EnumInputMethod; 
     
    763769                UnicornCall.logger.trace("condId : " + cond.getId()); 
    764770                UnicornCall.logger.trace("condType : " + cond.getType()); 
    765                 UnicornCall.logger.trace("condObserver : " + cond.getObserver().getID()); 
    766771                UnicornCall.logger.trace("condValue : " + cond.getValue()); 
     772 
    767773                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)) { 
    775776                                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    } 
    805807 
    806808                cond.setResult(passed); 
     
    938940                        e.printStackTrace(); 
    939941                        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); 
    944956                        } catch (MalformedURLException e1) { 
    945957                                e1.printStackTrace(); 
  • org/w3c/unicorn/index/IndexGenerator.java

    r148 r169  
    1 // $Id: IndexGenerator.java,v 1.4 2008-09-02 13:22:16 fbatard Exp $ 
     1// $Id: IndexGenerator.java,v 1.5 2008-09-12 18:01:51 jean-gui Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    107107                        ParseErrorException, Exception { 
    108108                IndexGenerator.logger.trace("generateIndexes"); 
    109  
    110109                final File[] tFile = ListFiles.listFiles(Property 
    111110                                .get("PATH_TO_INDEX_TEMPLATES"), "\\.vm$"); 
  • org/w3c/unicorn/response/Response.java

    r168 r169  
    2020     */ 
    2121    protected Map<String, Map<String, Result>> mapOfLangURIResult = new LinkedHashMap<String, Map<String,Result>>(); 
    22      
     22 
    2323    /** 
    2424     * Gets the value of the uri property. 
  • org/w3c/unicorn/response/parser/DefaultParser.java

    r168 r169  
    2828import org.w3c.unicorn.response.Warning; 
    2929import org.w3c.unicorn.util.LocalizedString; 
    30 import java.io.*; 
    3130 
    3231/** 
     
    3736        protected static final Log logger = LogFactory 
    3837                        .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         } 
    6038 
    6139    /** 
  • org/w3c/unicorn/response/parser/ResponseParser.java

    r168 r169  
    66 
    77public interface ResponseParser { 
    8         public Response parse(InputStream inputStream); 
    98  public Response parse(String r); 
    109} 
  • org/w3c/unicorn/response/parser/ResponseParserFactory.java

    r168 r169  
    3232         
    3333        /** 
    34          * Parses the input stream thanks to a response parse and  
     34         * Parses the string thanks to a response parser and  
    3535         * returns the response. 
    36          * @param is The input stream. 
     36         * @param r the string 
    3737         * @param responseType The type of the response. 
    3838         * @return The response parsed corresponding to the input. 
    3939         */ 
    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  
    5440    public static Response parse(String r, String responseType) { 
    5541                try { 
  • org/w3c/unicorn/tasklist/TaskListUnmarshallerBeans.java

    r164 r169  
    4444/** 
    4545 * Unmarshals the tasklist thanks to the XMLBeans tools. 
    46  *  
     46 * 
    4747 * @author Florent Batard, Jonathan Barouh 
    48  *  
     48 * 
    4949 */ 
    5050public class TaskListUnmarshallerBeans implements TasksListUnmarshaller { 
    5151 
    52         private TasklistDocument aTaskList;      
    53          
     52        private TasklistDocument aTaskList; 
     53 
    5454        private static final Log logger = LogFactory.getLog("org.w3c.unicorn.tasklist"); 
    55          
     55 
    5656        private int NodeID=0; 
    5757 
    58          
     58 
    5959        /** 
    6060         * The tasklist corresponding to the xml file 
    6161         */ 
    6262        private Map<String,Task> mapOfTask; 
    63          
     63 
    6464        /** 
    6565         * The observers' list used to check some constraints on the tasks 
    6666         */ 
    6767        private Map<String, Observer> mapOfObserver; 
    68          
    69          
     68 
     69 
    7070        public TaskListUnmarshallerBeans(){} 
    71          
     71 
    7272        public TaskListUnmarshallerBeans(final Map<String, Observer> mapOfObserver) { 
    73                 TaskListUnmarshallerBeans.logger.trace("Constructor");   
     73                TaskListUnmarshallerBeans.logger.trace("Constructor"); 
    7474                this.mapOfTask = new LinkedHashMap<String, org.w3c.unicorn.tasklist.Task>(); 
    7575                this.mapOfObserver = mapOfObserver; 
    7676        } 
    77          
    78  
    79          
     77 
     78 
     79 
    8080        private void addTask(final TaskType aTask) throws ParameterException { 
    8181                TaskListUnmarshallerBeans.logger.trace("addTask"); 
    82                  
     82 
    8383                if (aTask == null) { 
    8484                        TaskListUnmarshallerBeans.logger.warn("Task : null"); 
    8585                        return; 
    8686                } 
    87                  
     87 
    8888                if (TaskListUnmarshallerBeans.logger.isDebugEnabled()) { 
    8989                        TaskListUnmarshallerBeans.logger.trace("Add task : " + aTask.getId()); 
    9090                } 
    91                  
     91 
    9292                final Task aTaskCurrent = new Task(); 
    9393//              Create the execution level tree 
    9494                aTaskCurrent.setID(aTask.getId()); 
    9595                aTaskCurrent.setTree(this.ExpandTree(aTask)); 
    96                  
     96 
    9797//               parameters 
    9898                final ParametersType aParameters = aTask.getParameters(); 
    9999                if (aParameters != null) { 
    100100                        final ParameterType[] listOfParameter; 
    101                         listOfParameter = aParameters.getParameterArray();               
    102                          
     101                        listOfParameter = aParameters.getParameterArray(); 
     102 
    103103                        for (final ParameterType aParameterBeans : listOfParameter) { 
    104                                  
     104 
    105105                                final TUi.Enum aTUi = aParameterBeans.getUi(); 
    106106                                final String sObserver = aParameterBeans.getObserver(); 
    107107                                final String sName = aParameterBeans.getName(); 
    108                                  
     108 
    109109                                // default values as string 
    110110                                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 
    116116                                if (sObserver != null && !"".equals(sObserver)) { 
    117117                                        aParameter = getParameterFromObserver( 
     
    120120                                                        aTUi, 
    121121                                                        sDefaultValues, 
    122                                                         aParamType);                                     
    123                                 }                                                                
     122                                                        aParamType); 
     123                                } 
    124124                                else { 
    125                                          
     125 
    126126                                        // Values 
    127127                                        final Map<String, Value> mapOfValue = new LinkedHashMap<String, Value>(); 
    128                                         for (final ValueType aValue :  
     128                                        for (final ValueType aValue : 
    129129                                                aParameterBeans.getValueArray()) { 
    130                                                  
     130 
    131131                                                // name of the value 
    132132                                                String sValueName = aValue.getName(); 
     
    134134                                                        sValueName = ""; 
    135135                                                } 
    136                                                  
     136 
    137137                                                // Mappings of the value 
    138138                                                final Map<String, List<Mapping>> mapOfMapping = new LinkedHashMap<String, List<Mapping>>(); 
     
    155155                                                                                sValueName)); 
    156156                                        } 
    157                                          
     157 
    158158                                        aParameter = this.createParameter( 
    159159                                                        aParamType, 
    160160                                                        sName, 
    161161                                                        aTUi, 
    162                                                         sDefaultValues,  
     162                                                        sDefaultValues, 
    163163                                                        mapOfValue); 
    164164                                } 
    165                                  
    166                                 if (aParameter != null) {                                        
     165 
     166                                if (aParameter != null) { 
    167167                                        aTaskCurrent.addParameter(aParameter); 
    168168                                } 
     
    173173 
    174174        } 
    175          
    176          
     175 
     176 
    177177        /** 
    178178         * Creates a usable mapping from a JAXB-generated one. 
     
    195195 
    196196                // the mapped parameter 
    197                 final String sMappingParam = aMapped.getParam();                 
     197                final String sMappingParam = aMapped.getParam(); 
    198198                // the value mapped 
    199199                String sMappingValue = aMapped.getValue(); 
     
    201201                        sMappingValue = ""; 
    202202                } 
    203                  
     203 
    204204                // TODO check if is useful to add input method in mapping 
    205205                final List<EnumInputMethod> listOfEnumInputMethod = new ArrayList<EnumInputMethod>(); 
    206                  
     206 
    207207                // 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>(); 
    211211                for (Object methodString : aMapped.getInputmethod()) { 
    212212                        listOfTInputMethodBeans.add( 
     
    219219                        listOfTInputMethodBeans.add(TInputMethod.URI); 
    220220                } 
    221                  
     221 
    222222                /* 
    223223                 * For each input method, we check that the mapped observer: 
    224224                 *  - 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 
    226226                 *    method 
    227                  *  - can handle this value for this parameter  
     227                 *  - can handle this value for this parameter 
    228228                 */ 
    229229 
     
    234234                        if (aObserverMapped.getInputMethod(aEnumInputMethod) == null) { 
    235235                                TaskListUnmarshallerBeans.logger.warn( 
    236                                                 sMappingObserver + " does not support " +  
     236                                                sMappingObserver + " does not support " + 
    237237                                                aEnumInputMethod.value() + " input method."); 
    238238                                continue; 
    239239                        } 
    240240                        final CallParameter aCallParameterMapped; 
    241                         aCallParameterMapped = aObserverMapped.getInputMethod(aEnumInputMethod).getCallParameterByName(sMappingParam);           
     241                        aCallParameterMapped = aObserverMapped.getInputMethod(aEnumInputMethod).getCallParameterByName(sMappingParam); 
    242242                        // the parameter exists 
    243243                        if (aCallParameterMapped == null) { 
     
    250250                        if (!aCallParameterMapped.contains(sMappingValue)) { 
    251251                                TaskListUnmarshallerBeans.logger.error( 
    252                                                 "Parameter " + sMappingParam +  
     252                                                "Parameter " + sMappingParam + 
    253253                                                " does not accept " + sMappingValue + 
    254254                                                " as a value."); 
     
    257257                        listOfEnumInputMethod.add(aEnumInputMethod); 
    258258                } 
    259                  
     259 
    260260                if (listOfEnumInputMethod.size() == 0) { 
    261261                        return null; 
    262262                } 
    263                  
     263 
    264264                return new Mapping( 
    265265                                aObserverMapped, 
    266266                                sMappingParam, 
    267                                 sMappingValue/*,  
     267                                sMappingValue/*, 
    268268                                listOfEnumInputMethod*/); 
    269269        } 
    270          
    271          
     270 
     271 
    272272        private Parameter getParameterFromObserver ( 
    273273                        final String sParamName, 
     
    284284                        TaskListUnmarshallerBeans.logger.debug("TParamType : "+aTParamType+"."); 
    285285                } 
    286                  
     286 
    287287                final Observer aObserver = this.mapOfObserver.get(sObserverName); 
    288                  
     288 
    289289                // does the requested observer exist? 
    290290                if (aObserver == null) { 
     
    294294                        return null; 
    295295                } 
    296                  
     296 
    297297                // the name of the parameter 
    298298                // TODO Change when the RDF is done 
    299299                final LocalizedString aLocalizedString = new LocalizedString(); 
    300                 aLocalizedString.addLocalization("en", sParamName);              
    301                  
     300                aLocalizedString.addLocalization("en", sParamName); 
     301 
    302302                final Map<String, Value> mapOfValue = new LinkedHashMap<String, Value>(); 
    303                  
     303 
    304304                // iterate over the observer's methods 
    305305                final Map<EnumInputMethod, InputMethod> mapOfInputMethod = aObserver.getMapOfInputMethod(); 
    306306                for (final EnumInputMethod aEnumInputMethod : mapOfInputMethod.keySet()) { 
    307                         final InputMethod aInputMethod = mapOfInputMethod.get(aEnumInputMethod);                         
    308                          
     307                        final InputMethod aInputMethod = mapOfInputMethod.get(aEnumInputMethod); 
     308 
    309309                        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 
    311311                                // method, so it must be ignored 
    312312                                TaskListUnmarshallerBeans.logger.info( 
    313313                                                "The referenced parameter is an input one for the current method, so it must be ignored."); 
    314314                                continue; 
    315                         }                        
    316                          
     315                        } 
     316 
    317317                        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 
    320320                        if (aCallParameter != null) { 
    321321                                for (final String sValue : aCallParameter.getListOfPossibleValue()) { 
     
    324324                                                // the newly created parameter already contains a 
    325325                                                // similar value 
    326                                                  
    327                                                 // we know that the created parameter contains exactly  
     326 
     327                                                // we know that the created parameter contains exactly 
    328328                                                // ONE mapping for this value 
    329329                                                //aValueCurrent.getMappings().get(sObserverName).get(0).addInputMethod(aEnumInputMethod); 
     
    336336                                                // TODO Add localized names in RDF contract 
    337337                                                aInternationalizedMessageValueName.addLocalization("en", sValue); 
    338                                                  
     338 
    339339                                                final List<EnumInputMethod> mapOfNewInputMethod = new ArrayList<EnumInputMethod>(); 
    340340                                                mapOfNewInputMethod.add(aEnumInputMethod); 
    341341                                                final Mapping aMapping = new Mapping( 
    342342                                                                aObserver, 
    343                                                                 sParamName,  
     343                                                                sParamName, 
    344344                                                                sValue); 
    345345 
     
    357357                                                mapOfValue.put(sValue, aValueToAdd); 
    358358                                        } 
    359                                 }                                
     359                                } 
    360360                        } 
    361361                } 
     
    364364                                sParamName, 
    365365                                aTUi, 
    366                                 sDefaultValues,  
    367                                 mapOfValue);     
    368         } 
    369          
    370          
     366                                sDefaultValues, 
     367                                mapOfValue); 
     368        } 
     369 
     370 
    371371        /** 
    372372         * Create the tree from a TaskType element 
    373          *  
     373         * 
    374374         * @param myTask 
    375375         *            the task to transform into a tree 
     
    393393        /** 
    394394         * Recursion over the Then tag to fill the tree 
    395          *  
     395         * 
    396396         * @param myThen 
    397397         *            the ThenType node for the recursion 
     
    415415        /** 
    416416         * Created the Ifnode in the tree 
    417          *  
     417         * 
    418418         * @param ifs 
    419419         *            the IfType node template to create the Ifnode 
     
    461461                return ifnode; 
    462462        } 
    463          
    464          
    465          
    466          
     463 
     464 
     465 
     466 
    467467        private org.w3c.unicorn.tasklist.parameters.Parameter createParameter ( 
    468468                        final TParamType.Enum aTParamType, 
     
    490490                return aParameter; 
    491491        } 
    492          
    493          
     492 
     493 
    494494        /** 
    495495         * Wraps a TInputMethod instance on an EnumInputMethod 
     
    507507                        default: 
    508508                                return EnumInputMethod.URI; 
    509                 }                
    510         } 
    511          
    512          
    513          
     509                } 
     510        } 
     511 
     512 
     513 
    514514        public Map<String, org.w3c.unicorn.tasklist.Task> getMapOfTask() { 
    515515                TaskListUnmarshallerBeans.logger.trace("getMapOfTask"); 
     
    524524 
    525525                        try { 
    526                                 this.aTaskList = TasklistDocument.Factory.parse(aURL.openStream());                      
     526        ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 
     527                                this.aTaskList = TasklistDocument.Factory.parse(aURL.openStream()); 
    527528                        } catch (XmlException e) { 
    528529                                TaskListUnmarshallerBeans.logger.error("Parsing error in TasklistUnmarshaller",e); 
    529530                                e.printStackTrace(); 
    530                         }        
    531         } 
    532          
    533          
     531                        } 
     532        } 
     533 
     534 
    534535 
    535536        public void unmarshal() throws Exception { 
     
    543544                        } 
    544545                } 
    545                  
     546 
    546547                // computes and replaces references by their corresponding observations 
    547548                // and parameters 
  • org/w3c/unicorn/tests/FirstServlet.java

    r102 r169  
    1 // $Id: FirstServlet.java,v 1.11 2008-07-02 17:34:47 jean-gui Exp $ 
     1// $Id: FirstServlet.java,v 1.12 2008-09-12 18:01:51 jean-gui Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    6464        public void init (final ServletConfig aServletConfig) throws ServletException { 
    6565                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 
    8867                FirstServlet.factory.setRepository( 
    8968                                new File(Property.get("UPLOADED_FILES_REPOSITORY"))); 
     69 
    9070                try { 
    91                         IndexGenerator.generateIndexes(); 
     71        IndexGenerator.generateIndexes(); 
    9272                } 
    9373                catch (final ResourceNotFoundException e) { 
     
    10484                } 
    10585                FirstServlet.logger.info("End of initialisation of servlet."); 
     86 
    10687        } 
    10788 
  • org/w3c/unicorn/util/Property.java

    r89 r169  
    1 // $Id: Property.java,v 1.3 2008-06-17 13:45:31 jbarouh Exp $ 
     1// $Id: Property.java,v 1.4 2008-09-12 18:01:51 jean-gui Exp $ 
    22// Author: Damien LEROY. 
    33// (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. 
     
    118118                                break; 
    119119                        } 
    120                 } 
     120                }     
    121121                Property.addProperty(aProperty); 
    122122        } 
  • org/w3c/unicorn/util/remote-unicorn.properties

    r81 r169  
    3636TEMPLATE_FILE_EXTENSION = .vm 
    3737 
    38 UPLOADED_FILES_REPOSITORY = $UNICORN_HOME , WEB-INF/uploaded-files/ 
     38UPLOADED_FILES_REPOSITORY = $UNICORN_HOME , uploaded-files/ 
    3939DELETE_UPLOADED_FILES = true 
    4040 
  • org/w3c/unicorn/util/unicorn.properties

    r148 r169  
    11 
    22UNICORN_URL = http://localhost:8080/unicorn 
    3 UNICORN_HOME = /var/lib/tomcat5.5/webapps/unicorn/ 
     3UNICORN_HOME = /opt/Jigsaw/Jigsaw/WWW/unicorn/ 
    44UNICORN_ENCODING = UTF-8 
    55 
     
    1111FILESYSTEM_PREFIX = file: 
    1212 
    13 SERVER_TYPE = tomcat 
     13SERVER_TYPE = jigsaw 
    1414 
    15 PATH_TO_RESOURCES = $UNICORN_HOME , WEB-INF/resources/ 
     15PATH_TO_RESOURCES = $UNICORN_HOME , resources/ 
    1616PATH_TO_OBSERVER_LIST = $PATH_TO_RESOURCES 
    1717PATH_TO_TASKLIST = $PATH_TO_RESOURCES , tasklist/ 
     
    3939TEMPLATE_FILE_EXTENSION = .vm 
    4040 
    41 UPLOADED_FILES_REPOSITORY = $UNICORN_HOME , WEB-INF/uploaded-files/ 
     41UPLOADED_FILES_REPOSITORY = $UNICORN_HOME , uploaded-files/ 
    4242DELETE_UPLOADED_FILES = true 
    4343 
  • resources/tasklist/new-tasklist.xml

    r165 r169  
    55         
    66        <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 
    1357                <outputseq> 
    1458                        <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> 
    1664                        </outputgroup> 
    1765                </outputseq> 
    1866 
    1967                 
    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>  
    7969         
    8070</tasklist> 
  • resources/tasklist/tasklist.rdf

    r165 r169  
    2525                 
    2626        </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          
    3527 
    3628</rdf:RDF>