Changeset 89:b4b323be9768

Show
Ignore:
Timestamp:
06/17/08 13:45:32 (5 years ago)
Author:
jbarouh
Branch:
default
convert_revision:
svn:cdcfb263-7567-472c-a848-e2c2df3466e7/trunk@90
Message:

Updating Javadoc for the project.

Location:
org/w3c/unicorn
Files:
29 modified

Legend:

Unmodified
Added
Removed
  • org/w3c/unicorn/response/Longmessage.java

    r71 r89  
    4141    protected String lang; 
    4242 
     43    /** 
     44     *  
     45     * @return The list of the contents. 
     46     */ 
    4347    public List<Object> getContent() { 
    4448        if (content == null) { 
     
    4852    } 
    4953 
     54    /** 
     55     * Sets the contents of the message. 
     56     * @param content The list to set. 
     57     */ 
    5058        public void setContent(List<Object> content) { 
    5159                this.content = content; 
     
    6169        } 
    6270*/ 
     71        /** 
     72         * @return The language of the message. 
     73         */ 
    6374        public String getLang() { 
    6475                return lang; 
    6576        } 
    6677 
     78        /** 
     79         * Sets the language for this message. 
     80         * @param lang The language of the message. 
     81         */ 
    6782        public void setLang(String lang) { 
    6883                this.lang = lang; 
  • org/w3c/unicorn/response/Response.java

    r71 r89  
    159159    } 
    160160     
     161    /** 
     162     * Gets the result of the specified URI given a language. 
     163     * @param lang The language to consider. 
     164     * @param uri  The URI to consider. 
     165     * @return The result in the given language for the URI. 
     166     */ 
    161167    public Result getResult(String lang, String uri) { 
    162168        if (mapOfLangURIResult.get(lang)==null) 
     
    168174 
    169175    /** 
    170          * add a Result r to the map, if theres is already a result which have the 
     176         * Adds a Result r to the map, if there is already a result which has the 
    171177         * same uri and the same language, we will append r to this result otherwise 
    172          * we'll simply add r to the list 
     178         * we'll simply add r to the list. 
     179         * @param value The value of the result. 
    173180         */ 
    174181    public void addResult(Result value) { 
     
    187194    } 
    188195 
     196    /** 
     197     *  
     198     * @return The list of errors corresponding to the results. 
     199     */ 
    189200    List<Error> getErrorList() { 
    190201        List<Error> xList = new ArrayList<Error>(); 
     
    199210    } 
    200211     
     212    /** 
     213     *  
     214     * @return The list of warnings corresponding to the results. 
     215     */ 
    201216    List<Warning> getWarningList() { 
    202217        List<Warning> xList = new ArrayList<Warning>(); 
     
    211226    } 
    212227     
     228    /** 
     229     *  
     230     * @return The list of infos corresponding to the results. 
     231     */ 
    213232    List<Info> getAllInfo() { 
    214233        List<Info> xList = new ArrayList<Info>(); 
  • org/w3c/unicorn/response/Result.java

    r71 r89  
    1111        protected List<Info> infos = new ArrayList<Info>(); 
    1212         
     13        /** 
     14         * Constructor for Result. 
     15         * @param lang The language to consider. 
     16         * @param uri The URI to consider. 
     17         */ 
    1318        public Result(String lang, String uri) { 
    1419                super(); 
     
    1621                this.lang = lang; 
    1722        } 
     23         
     24        /**  
     25         *  
     26         * @return The URI of the result. 
     27         */ 
    1828        public String getUri() { 
    1929                return uri; 
    2030        } 
     31         
     32        /** 
     33         *  
     34         * @return The list of errors. 
     35         */ 
    2136        public List<Error> getErrors() { 
    2237                return errors; 
    2338        } 
     39         
     40        /** 
     41         *  
     42         * @return The list of warnings. 
     43         */ 
    2444        public List<Warning> getWarnings() { 
    2545                return warnings; 
    2646        } 
     47         
     48        /** 
     49         *  
     50         * @return The list of infos. 
     51         */ 
    2752        public List<Info> getInfos() { 
    2853                return infos; 
    2954        } 
     55         
     56        /** 
     57         *  
     58         * @return The language of the result. 
     59         */ 
    3060        public String getLang() { 
    3161                return lang; 
  • org/w3c/unicorn/response/parser/DefaultParser.java

    r71 r89  
    2929import org.w3c.unicorn.util.LocalizedString; 
    3030 
     31/** 
     32 * Default parser class. 
     33 *  
     34 */ 
    3135public class DefaultParser implements ResponseParser { 
    32         protected static final Log logger = LogFactory.getLog("org.w3c.unicorn.response.parser.DefaultParser"); 
     36        protected static final Log logger = LogFactory 
     37                        .getLog("org.w3c.unicorn.response.parser.DefaultParser"); 
     38 
    3339        private static JAXBContext aJAXBContext = null; 
     40 
    3441        private static Unmarshaller aUnmarshaller = null; 
    35          
     42 
    3643        static { 
    3744                try { 
    38                         aJAXBContext = JAXBContext.newInstance("org.w3c.unicorn.generated.observationresponse"); 
     45                        aJAXBContext = JAXBContext 
     46                                        .newInstance("org.w3c.unicorn.generated.observationresponse"); 
    3947                        aUnmarshaller = aJAXBContext.createUnmarshaller(); 
    40                 } 
    41                 catch (final JAXBException e) { 
     48                } catch (final JAXBException e) { 
    4249                        logger.error("JAXBException : " + e.getMessage(), e); 
    4350                        e.printStackTrace(); 
    4451                } 
    4552        } 
    46          
     53 
     54        /** 
     55         * Parses the input and returns the response. 
     56         * @param inputStream The input stream. 
     57         * @return The corresponding response. 
     58         */ 
    4759        public Response parse(InputStream inputStream) { 
    4860                try { 
    49                         return swap((Observationresponse)(aUnmarshaller.unmarshal(inputStream))); 
     61                        return swap((Observationresponse) (aUnmarshaller 
     62                                        .unmarshal(inputStream))); 
    5063                } catch (JAXBException e) { 
    5164                        logger.error("JAXBException : " + e.getMessage(), e); 
     
    5467                } 
    5568        } 
    56          
     69 
     70        /** 
     71         * Returns a list of localized strings from a list of simple strings 
     72         * and a given language. 
     73         * @param x The list of strings. 
     74         * @param lang The language of the list. 
     75         * @return The new list of localized strings. 
     76         */ 
    5777        private List<LocalizedString> swapListMessage(List<String> x, String lang) { 
    5878                List<LocalizedString> y = new ArrayList<LocalizedString>(); 
    5979                for (Object ox : x) { 
    60                         String cox = (String)ox; 
     80                        String cox = (String) ox; 
    6181                        LocalizedString coy = new LocalizedString(cox, lang); 
    6282                        y.add(coy); 
     
    6585        } 
    6686 
     87        /** 
     88         * Returns a list of localized objects from a list of simple objects 
     89         * and a given language.  
     90         * @param x The initial list of objects. 
     91         * @param lang The language of the list. 
     92         * @return The new list of localized objects. 
     93         */ 
    6794        private List<Object> swap(List<Object> x, String lang) { 
    6895                List<Object> y = new ArrayList<Object>(); 
    6996                for (Object ox : x) { 
    7097                        if (ox instanceof String) { 
    71                                 String cox = (String)ox; 
     98                                String cox = (String) ox; 
    7299                                LocalizedString coy = new LocalizedString(cox, lang); 
    73100                                y.add(coy); 
    74                         }  
    75                         else if (ox instanceof org.w3c.unicorn.generated.observationresponse.A) { 
    76                                 org.w3c.unicorn.generated.observationresponse.A cox = (org.w3c.unicorn.generated.observationresponse.A)ox; 
     101                        } else if (ox instanceof org.w3c.unicorn.generated.observationresponse.A) { 
     102                                org.w3c.unicorn.generated.observationresponse.A cox = (org.w3c.unicorn.generated.observationresponse.A) ox; 
    77103                                A coy = new A(); 
    78104                                coy.setHref(cox.getHref()); 
    79105                                coy.setContent(swap(cox.getContent(), lang)); 
    80106                                y.add(coy); 
    81                         } 
    82                         else if (ox instanceof org.w3c.unicorn.generated.observationresponse.Code) { 
    83                                 org.w3c.unicorn.generated.observationresponse.Code cox = (org.w3c.unicorn.generated.observationresponse.Code)ox; 
     107                        } else if (ox instanceof org.w3c.unicorn.generated.observationresponse.Code) { 
     108                                org.w3c.unicorn.generated.observationresponse.Code cox = (org.w3c.unicorn.generated.observationresponse.Code) ox; 
    84109                                Code coy = new Code(); 
    85110                                coy.setContent(swap(cox.getContent(), lang)); 
    86111                                y.add(coy); 
    87                         } 
    88                         else if (ox instanceof org.w3c.unicorn.generated.observationresponse.Img) { 
    89                                 org.w3c.unicorn.generated.observationresponse.Img cox = (org.w3c.unicorn.generated.observationresponse.Img)ox; 
     112                        } else if (ox instanceof org.w3c.unicorn.generated.observationresponse.Img) { 
     113                                org.w3c.unicorn.generated.observationresponse.Img cox = (org.w3c.unicorn.generated.observationresponse.Img) ox; 
    90114                                Img coy = new Img(); 
    91115                                coy.setAlt(cox.getAlt()); 
     
    100124                return y; 
    101125        } 
    102          
    103         private Longmessage swap(org.w3c.unicorn.generated.observationresponse.Longmessage x, String lang) { 
     126 
     127        /** 
     128         * Swaps a message : returns the result with the corresponding language. 
     129         * @param x The message to swap. 
     130         * @param lang The language of the message. 
     131         * @return The swapped message. 
     132         */ 
     133        private Longmessage swap( 
     134                        org.w3c.unicorn.generated.observationresponse.Longmessage x, 
     135                        String lang) { 
    104136                Longmessage y = new Longmessage(); 
    105                 y.setContent(swap(x.getContent(),lang)); 
    106                 return y; 
    107         } 
    108          
    109         private List<Longmessage> swapListLongmessage(List<org.w3c.unicorn.generated.observationresponse.Longmessage> x, String lang) { 
     137                y.setContent(swap(x.getContent(), lang)); 
     138                return y; 
     139        } 
     140 
     141        /** 
     142         * Returns a list of localized messages from a list of simple messages 
     143         * and a given language. 
     144         * @param x The list of messages. 
     145         * @param lang The language of the list. 
     146         * @return The new list of localized messages. 
     147         */ 
     148        private List<Longmessage> swapListLongmessage( 
     149                        List<org.w3c.unicorn.generated.observationresponse.Longmessage> x, 
     150                        String lang) { 
    110151                List<Longmessage> y = new ArrayList<Longmessage>(); 
    111152                for (Object ox : x) { 
    112                         org.w3c.unicorn.generated.observationresponse.Longmessage cox = (org.w3c.unicorn.generated.observationresponse.Longmessage)ox; 
     153                        org.w3c.unicorn.generated.observationresponse.Longmessage cox = (org.w3c.unicorn.generated.observationresponse.Longmessage) ox; 
    113154                        Longmessage coy = swap(cox, lang); 
    114155                        y.add(coy); 
     
    117158        } 
    118159 
    119         private Warning swap(org.w3c.unicorn.generated.observationresponse.Warning x, String lang) { 
     160        /** 
     161         * Swaps a warning : returns the result with the corresponding language. 
     162         * @param x The warning to swap. 
     163         * @param lang The language of the warning. 
     164         * @return The swapped warning. 
     165         */ 
     166        private Warning swap( 
     167                        org.w3c.unicorn.generated.observationresponse.Warning x, String lang) { 
    120168                Warning y = new Warning(); 
    121169                y.setLine(x.getLine()); 
     
    128176        } 
    129177 
    130         private Error swap(org.w3c.unicorn.generated.observationresponse.Error x, String lang) { 
     178        /** 
     179         * Swaps an error : returns the result with the corresponding language. 
     180         * @param x The error to swap. 
     181         * @param lang The language of the error. 
     182         * @return The swapped error. 
     183         */ 
     184        private Error swap(org.w3c.unicorn.generated.observationresponse.Error x, 
     185                        String lang) { 
    131186                Error y = new Error(); 
    132187                y.setLine(x.getLine()); 
     
    138193                return y; 
    139194        } 
    140          
    141         private Info swap(org.w3c.unicorn.generated.observationresponse.Info x, String lang) { 
     195 
     196        /** 
     197         * Swaps an info : returns the result with the corresponding language. 
     198         * @param x The info to swap. 
     199         * @param lang The language of the info. 
     200         * @return The swapped info. 
     201         */ 
     202        private Info swap(org.w3c.unicorn.generated.observationresponse.Info x, 
     203                        String lang) { 
    142204                Info y = new Info(); 
    143205                y.setLine(x.getLine()); 
     
    148210                return y; 
    149211        } 
    150          
     212 
     213        /** 
     214         * Swaps a response : returns the result with the corresponding language. 
     215         * @param x The response to swap. 
     216         * @param lang The language of the response. 
     217         * @return The swapped response. 
     218         */ 
    151219        private Response swap(Observationresponse or) { 
    152220                Response res = new Response(); 
     
    156224                res.setDate(or.getDate()); 
    157225                res.setPassed(or.isPassed()); 
    158                  
    159                 //Fill res.result 
    160                 org.w3c.unicorn.generated.observationresponse.Result rrr = or.getResult(); 
    161                 if (rrr!=null) { 
     226 
     227                // Fill res.result 
     228                org.w3c.unicorn.generated.observationresponse.Result rrr = or 
     229                                .getResult(); 
     230                if (rrr != null) { 
    162231                        Warnings warnings = rrr.getWarnings(); 
    163                         if (warnings!=null && warnings.getWarninglist()!=null) { 
     232                        if (warnings != null && warnings.getWarninglist() != null) { 
    164233                                for (Warninglist wl : warnings.getWarninglist()) { 
    165234                                        String lang = warnings.getLang(); 
    166235                                        Result r = new Result(lang, wl.getUri()); 
    167                                         for (org.w3c.unicorn.generated.observationresponse.Warning w : wl.getWarning()) { 
     236                                        for (org.w3c.unicorn.generated.observationresponse.Warning w : wl 
     237                                                        .getWarning()) { 
    168238                                                r.getWarnings().add(swap(w, lang)); 
    169239                                        } 
     
    171241                                } 
    172242                        } 
    173                          
     243 
    174244                        Errors errors = rrr.getErrors(); 
    175                         if (errors!=null && errors.getErrorlist()!=null) { 
     245                        if (errors != null && errors.getErrorlist() != null) { 
    176246                                for (Errorlist wl : errors.getErrorlist()) { 
    177247                                        String lang = errors.getLang(); 
    178                                         Result r = new Result(errors.getLang(),wl.getUri()); 
    179                                         for (org.w3c.unicorn.generated.observationresponse.Error w : wl.getError()) { 
     248                                        Result r = new Result(errors.getLang(), wl.getUri()); 
     249                                        for (org.w3c.unicorn.generated.observationresponse.Error w : wl 
     250                                                        .getError()) { 
    180251                                                r.getErrors().add(swap(w, lang)); 
    181252                                        } 
    182253                                        res.addResult(r); 
    183                                 }                
    184                         } 
    185                  
     254                                } 
     255                        } 
     256 
    186257                        Informations informations = rrr.getInformations(); 
    187                         if (informations!=null && informations.getInfolist()!=null) { 
     258                        if (informations != null && informations.getInfolist() != null) { 
    188259                                String lang = informations.getLang(); 
    189260                                for (Infolist wl : informations.getInfolist()) { 
    190261                                        Result r = new Result(informations.getLang(), wl.getUri()); 
    191                                         for (org.w3c.unicorn.generated.observationresponse.Info w : wl.getInfo()) { 
     262                                        for (org.w3c.unicorn.generated.observationresponse.Info w : wl 
     263                                                        .getInfo()) { 
    192264                                                r.getInfos().add(swap(w, lang)); 
    193265                                        } 
     
    196268                        } 
    197269                } 
    198                  
    199                  
     270 
    200271                return res; 
    201272        } 
    202          
     273 
    203274} 
  • org/w3c/unicorn/response/parser/ResponseParserFactory.java

    r71 r89  
    1010import org.xml.sax.SAXException; 
    1111 
     12/** 
     13 * Factory to create ResponseParsers 
     14 * 
     15 */ 
    1216public class ResponseParserFactory { 
     17         
     18        /** 
     19         * Creates a parser corresponding to the type of the response. 
     20         * @param responseType The type of the response. 
     21         * @return The created parser. 
     22         * @throws SAXException 
     23         * @throws ParserConfigurationException 
     24         * @throws IOException 
     25         */ 
    1326        public static ResponseParser createResponseParser(String responseType) throws SAXException, ParserConfigurationException, IOException { 
    1427                ResponseParser rsp = Framework.mapOfReponseParser.get(responseType); 
     
    1831        } 
    1932         
     33        /** 
     34         * Parses the input stream thanks to a response parse and  
     35         * returns the response. 
     36         * @param is The input stream. 
     37         * @param responseType The type of the response. 
     38         * @return The response parsed corresponding to the input. 
     39         */ 
    2040        public static Response parse(InputStream is, String responseType) { 
    2141                try { 
  • org/w3c/unicorn/tasklist/Observation.java

    r1 r89  
    1 // $Id: Observation.java,v 1.1.1.1 2006-08-31 09:09:26 dleroy Exp $ 
     1// $Id: Observation.java,v 1.2 2008-06-17 13:45:32 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    117117        } 
    118118 
     119        /** 
     120         * Parses the mapOfMimeTypePriority in order to check if the given type 
     121         * matches an existing one. 
     122         * @param aMimeType The type to check. 
     123         * @return True if the given type matches an existing one, else false. 
     124         */ 
    119125        public boolean allowMimeType ( 
    120126                        final MimeType aMimeType) { 
  • org/w3c/unicorn/tasklist/RDFUnmarshallerJena.java

    r1 r89  
    1 // $Id: RDFUnmarshallerJena.java,v 1.1.1.1 2006-08-31 09:09:26 dleroy Exp $ 
     1// $Id: RDFUnmarshallerJena.java,v 1.2 2008-06-17 13:45:32 jbarouh Exp $ 
    22// Author: Damien LEROY. 
    33// (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. 
     
    8686        private Model aModel = null; 
    8787 
     88        /** 
     89         * Default constructor. 
     90         * 
     91         */ 
    8892        public RDFUnmarshallerJena () { 
    8993                RDFUnmarshallerJena.logger.trace("Constructor"); 
     
    9195        } 
    9296 
     97        /** 
     98         * Adds a Model with the given URL to this aModel. 
     99         * @param aURL The URL to add. 
     100         */ 
    93101        public void addURL (final URL aURL) throws IOException { 
    94102                RDFUnmarshallerJena.logger.trace("addURL"); 
     
    101109        } 
    102110 
     111        /** 
     112         * Adds a name (with its language) to the given task. 
     113         * @param aTask The task to name. 
     114         * @param aLiteral The name of the task. 
     115         */ 
    103116        private void addLongName (final Task aTask, final Literal aLiteral) { 
    104117                RDFUnmarshallerJena.logger.debug( 
     
    108121        } 
    109122 
     123        /** 
     124         * Adds a description (with its language) to the given task. 
     125         * @param aTask The task to describe. 
     126         * @param aLiteral The description of the task. 
     127         */ 
    110128        private void addDescription (final Task aTask, final Literal aLiteral) { 
    111129                RDFUnmarshallerJena.logger.debug( 
     
    115133        } 
    116134 
     135        /** 
     136         * Adds a name (with its language) to the given parameter. 
     137         * @param aTask The parameter to name. 
     138         * @param aLiteral The name of the parameter. 
     139         */ 
    117140        private void addLongName (final Parameter aParameter, final Literal aLiteral) { 
    118141                RDFUnmarshallerJena.logger.debug( 
     
    122145        } 
    123146 
     147        /** 
     148         * Adds a name (with its language) to the given value. 
     149         * @param aTask The value to name. 
     150         * @param aLiteral The name of the value. 
     151         */ 
    124152        private void addLongName (final Value aValue, final Literal aLiteral) { 
    125153                RDFUnmarshallerJena.logger.debug( 
     
    129157        } 
    130158 
     159        /** 
     160         * Adds a mapping to the given value. 
     161         * @param value The value to map. 
     162         * @param aMapping The mapping for the value. 
     163         */ 
    131164        private void addMapping (final Value aValue, final Resource aMapping) { 
    132165                RDFUnmarshallerJena.logger.trace("addMapping"); 
     
    145178        } 
    146179 
     180        /** 
     181         * Adds a value to the given parameter. 
     182         * @param aParameter The parameter to consider. 
     183         * @param aValue The value to add. 
     184         */ 
    147185        private void addValue (final Parameter aParameter, final Resource aValue) { 
    148186                final String sValue = 
     
    175213        } 
    176214 
     215        /** 
     216         * Adds a parameter to the given task. 
     217         * @param aTask The task to consider. 
     218         * @param aParameter The parameter to add. 
     219         */ 
    177220        private void addParameter (final Task aTask, final Resource aParameter) { 
    178221                final String sParameterReference = 
     
    210253        } 
    211254 
     255        /** 
     256         * Adds a handler to the given task. 
     257         * @param aTask The task to consider. 
     258         * @param aHandler The handler to add. 
     259         * @throws MimeTypeParseException 
     260         */ 
    212261        private void addHandler (final Task aTask, final Resource aHandler) throws MimeTypeParseException { 
    213262                RDFUnmarshallerJena.logger.trace("addHandler"); 
     
    226275        } 
    227276 
     277        /** 
     278         * Adds a task to this object. 
     279         * @param aTask The task to add. 
     280         * @throws Exception 
     281         */ 
    228282        private void addTask (final Resource aTask) throws Exception { 
    229283                final Statement aReference = aTask.getProperty(RDFUnmarshallerJena.PROPERTY_REFERENCE); 
  • org/w3c/unicorn/tasklist/TasksListUnmarshallerJAXB.java

    r1 r89  
    1 // $Id: TasksListUnmarshallerJAXB.java,v 1.1.1.1 2006-08-31 09:09:27 dleroy Exp $ 
     1// $Id: TasksListUnmarshallerJAXB.java,v 1.2 2008-06-17 13:45:32 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    538538        } 
    539539         
    540         /** 
    541          * Main method used to test this class 
    542          * @param args 
    543          * @throws Exception 
    544          *//* 
    545         public static void main(String[] args) throws Exception { 
    546                 Map<String, Observer> observers = new LinkedHashMap<String, Observer>(); 
    547                  
    548                 Observer o = new Observer(); 
    549                 observers.put("css-validator", o); 
    550                  
    551                 Observer o2 = new Observer(); 
    552                 observers.put("link-checker", o2); 
    553  
    554                 TasksListUnmarshaller tlu = new TasksListUnmarshallerJAXB(observers); 
    555                 tlu.addURL(new URL("http://w3cstag8/~jean/xml/task2.xml")); 
    556                 tlu.unmarshal(); 
    557                  
    558                 RDFUnmarshaller rdfu = new RDFUnmarshallerJena(tlu.getMapOfTask()); 
    559                 rdfu.addURL(new URL("http://w3cstag8/~jean/xml/task.rdf")); 
    560                 rdfu.unmarshal(); 
    561                  
    562                 for (org.w3c.unicorn.tasklist.Task t : tlu.getMapOfTask().values()) { 
    563                         System.out.println(t); 
    564                         System.out.println("---------------------------------------"); 
    565                 } 
    566         }*/ 
     540 
    567541         
    568542} 
  • org/w3c/unicorn/tasklist/parameters/CheckboxListParameter.java

    r1 r89  
    1 // $Id: CheckboxListParameter.java,v 1.1.1.1 2006-08-31 09:09:27 dleroy Exp $ 
     1// $Id: CheckboxListParameter.java,v 1.2 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    1818        private Map<String, Value> mapOfDefaultValue; 
    1919 
     20        /** 
     21         * Default constructor for a CheckboxListParameter 
     22         * (see Parameter default constructor). 
     23         */ 
    2024        protected CheckboxListParameter () { 
    2125                super(); 
     
    2327        } 
    2428 
     29        /** 
     30         * Adds a Value object to the mapOfValue. 
     31         *  @param aValue The value to add. 
     32         */ 
    2533        public void addValue (final Value aValue) { 
    2634                this.mapOfValue.put(aValue.getName(), aValue); 
    2735        } 
    2836 
     37        /** 
     38         * Finds a Value object in the map given its name. 
     39         *  @param sName The name of the Value. 
     40         *  @return The Value object if the String corresponds to a key. 
     41         */ 
    2942        public Value getValue (final String sName) { 
    3043                return this.mapOfValue.get(sName); 
     
    3952        } 
    4053 
     54        /** 
     55         * Sets the default Value in the mapOfDefaultValue. 
     56         * @param sDefaultValues The new default value. 
     57         */ 
    4158        public void setDefaultValues (final String sDefaultValues) { 
    4259                this.mapOfDefaultValue = new LinkedHashMap<String, Value>(); 
     
    6380        } 
    6481 
     82        /** 
     83         * Defines or replaces the mapOfValue. 
     84         * @param mapOfValue The new map of values. 
     85         */ 
    6586        public void setMapOfValue (final Map<String, Value> mapOfValue) { 
    6687                this.mapOfValue = mapOfValue; 
    6788        } 
    6889 
     90        /** 
     91         * Returns the type of the parameter. 
     92         * @return The type CHECKBOXLIST. 
     93         */ 
    6994        public ParameterType getType () { 
    7095                return ParameterType.CHECKBOXLIST; 
    7196        } 
    7297 
     98        /** 
     99         * Merges a Parameter with this one if the type complies. 
     100         * @param aParameter The parameter to merge with the current one. 
     101         * @return True if they merged correctly, else false. 
     102         */ 
    73103        public boolean merge (final Parameter aParameter) { 
    74104                CheckboxListParameter.logger.trace("merge"); 
  • org/w3c/unicorn/tasklist/parameters/CheckboxParameter.java

    r1 r89  
    1 // $Id: CheckboxParameter.java,v 1.1.1.1 2006-08-31 09:09:27 dleroy Exp $ 
     1// $Id: CheckboxParameter.java,v 1.2 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    1919        private Map<String, Value> mapOfValue = null; 
    2020 
     21        /** 
     22         * Default constructor for a CheckboxParameter  
     23         * (see the Parameter default constructor). 
     24         */ 
    2125        protected CheckboxParameter () { 
    2226                super(); 
     
    2428        } 
    2529 
     30        /** 
     31         * Adds a Value object to the mapOfValue. 
     32         *  @param aValue The value to add. 
     33         */ 
    2634        public void addValue (final Value aValue) { 
    2735                this.mapOfValue.put(aValue.getName(), aValue); 
    2836        } 
    2937 
     38        /** 
     39         * Finds a Value object in the map given its name. 
     40         *  @param sName The name of the Value. 
     41         *  @return The Value object if the String corresponds to a key. 
     42         */ 
    3043        public Value getValue (final String sName) { 
    3144                return this.mapOfValue.get(sName); 
     
    4356        } 
    4457 
     58        /** 
     59         * Sets the default Value in the mapOfDefaultValue. 
     60         * @param sDefaultValues The new default value. 
     61         */ 
    4562        public void setDefaultValues (final String sDefaultValues) { 
    4663                this.bCheckedByDefault = ( 
     
    5673        } 
    5774         
     75        /** 
     76         * Defines or replaces the mapOfValue. 
     77         * @param mapOfValue The new map of values. 
     78         */ 
    5879        public void setMapOfValue (final Map<String, Value> mapOfValue) throws ParameterException { 
    5980                if (mapOfValue.size() > 2 || mapOfValue.size() < 1) { 
     
    6889        } 
    6990        /** 
    70          * @return Returns the checked. 
     91         * Gets the checked Value in the mapOfValue. 
     92         * @return Returns the checked Value. 
    7193         */ 
    7294        public Value getChecked () { 
     
    7597         
    7698        /** 
    77          * @param aValueChecked The checked to set. 
     99         * Sets the given Value to "checked" or adds it 
     100         * with this key. 
     101         * @param aValueChecked The Value to set as checked. 
    78102         */ 
    79103        public void setChecked (final Value aValueChecked) { 
     
    82106         
    83107        /** 
     108         * Gets the unchecked Value in the mapOfValue. 
    84109         * @return Returns the unchecked. 
    85110         */ 
     
    89114         
    90115        /** 
    91          * @param aValueUnchecked The unchecked to set. 
     116         * Sets the given Value to "unchecked" or adds it 
     117         * with this key. 
     118         * @param aValueUnchecked The Value to set as unchecked. 
    92119         */ 
    93120        public void setUnchecked (final Value aValueUnchecked) { 
     
    95122        } 
    96123 
     124        /** 
     125         * Returns the type of the parameter. 
     126         * @return The type CHECKBOX. 
     127         */ 
    97128        public ParameterType getType () { 
    98129                return ParameterType.CHECKBOX; 
    99130        } 
    100131 
     132        /** 
     133         * Merges a Parameter with this one if the type complies. 
     134         * @param aParameter The parameter to merge with the current one. 
     135         * @return True if they merged correctly, else false. 
     136         */ 
    101137        public boolean merge (final Parameter aParameter) { 
    102138                CheckboxParameter.logger.trace("merge"); 
  • org/w3c/unicorn/tasklist/parameters/DropDownParameter.java

    r1 r89  
    1 // $Id: DropDownParameter.java,v 1.1.1.1 2006-08-31 09:09:27 dleroy Exp $ 
     1// $Id: DropDownParameter.java,v 1.2 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    2020        private Value aValueDefault; 
    2121 
     22        /** 
     23         * Default constructor for a DropDownParameter  
     24         * (see the Parameter default constructor). 
     25         */ 
    2226        protected DropDownParameter () { 
    2327                super(); 
     
    2529        } 
    2630 
     31        /** 
     32         * Adds a Value object to the mapOfValue. 
     33         *  @param aValue The value to add. 
     34         */ 
    2735        public void addValue (final Value aValue) { 
    2836                this.mapOfValue.put(aValue.getName(), aValue); 
    2937        } 
    3038 
     39        /** 
     40         * Finds a Value object in the map given its name. 
     41         *  @param sName The name of the Value. 
     42         *  @return The Value object if the String corresponds to a key. 
     43         */ 
    3144        public Value getValue (final String sName) { 
    3245                return this.mapOfValue.get(sName); 
     
    4356        } 
    4457 
     58        /** 
     59         * Sets the default Value in the mapOfDefaultValue. 
     60         * @param sDefaultValues The new default value. 
     61         */ 
    4562        public void setDefaultValues (final String sDefaultValues) { 
    4663                this.aValueDefault = this.mapOfValue.get(sDefaultValues); 
     
    5572        } 
    5673 
     74        /** 
     75         * Defines or replaces the mapOfValue. 
     76         * @param mapOfValue The new map of values. 
     77         */ 
    5778        public void setMapOfValue (final Map<String, Value> mapOfValue) throws ParameterException { 
    5879                if (mapOfValue.size() < 1) { 
     
    6384        } 
    6485 
     86        /** 
     87         * Returns the type of the parameter. 
     88         * @return The type DROPDOWN. 
     89         */ 
    6590        public ParameterType getType () { 
    6691                return ParameterType.DROPDOWN; 
    6792        } 
    6893 
     94        /** 
     95         * Merges a Parameter with this one if the type complies. 
     96         * @param aParameter The parameter to merge with the current one. 
     97         * @return True if they merged correctly, else false. 
     98         */ 
    6999        public boolean merge (final Parameter aParameter) { 
    70100                DropDownParameter.logger.trace("merge"); 
  • org/w3c/unicorn/tasklist/parameters/Mapping.java

    r1 r89  
    1 // $Id: Mapping.java,v 1.1.1.1 2006-08-31 09:09:27 dleroy Exp $ 
     1// $Id: Mapping.java,v 1.2 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    139139                aStringBuffer.append(this.aObserver.getID()); 
    140140                aStringBuffer.append('.'); 
    141                 //aStringBuffer.append(this.listOfEnumInputMethod); 
    142141                aStringBuffer.append('.'); 
    143142                aStringBuffer.append(this.sParam); 
  • org/w3c/unicorn/tasklist/parameters/RadioParameter.java

    r1 r89  
    1 // $Id: RadioParameter.java,v 1.1.1.1 2006-08-31 09:09:27 dleroy Exp $ 
     1// $Id: RadioParameter.java,v 1.2 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    1919        private Value aValueDefault; 
    2020 
     21        /** 
     22         * Default constructor for a RadioParameter  
     23         * (see the Parameter default constructor). 
     24         */ 
    2125        protected RadioParameter () { 
    2226                super(); 
     
    2428        } 
    2529 
     30        /** 
     31         * Adds a Value object to the mapOfValue. 
     32         *  @param aValue The value to add. 
     33         */ 
    2634        public void addValue (final Value aValue) { 
    2735                this.mapOfValue.put(aValue.getName(), aValue); 
    2836        } 
    2937 
     38        /** 
     39         * Finds a Value object in the map given its name. 
     40         *  @param sName The name of the Value. 
     41         *  @return The Value object if the String corresponds to a key. 
     42         */ 
    3043        public Value getValue (final String sName) { 
    3144                return this.mapOfValue.get(sName); 
     
    4255        } 
    4356 
     57        /** 
     58         * Sets the default Value in the mapOfDefaultValue. 
     59         * @param sDefaultValues The new default value. 
     60         */ 
    4461        public void setDefaultValues (final String sDefaultValues) { 
    4562                this.aValueDefault = this.mapOfValue.get(sDefaultValues); 
     
    5471        } 
    5572 
     73        /** 
     74         * Defines or replaces the mapOfValue. 
     75         * @param mapOfValue The new map of values. 
     76         */ 
    5677        public void setMapOfValue (final Map<String, Value> mapOfValue) throws ParameterException { 
    5778                if (mapOfValue.size() == 0) { 
     
    6182        } 
    6283 
     84        /** 
     85         * Returns the type of the parameter. 
     86         * @return The type RADIO. 
     87         */ 
    6388        public ParameterType getType () { 
    6489                return ParameterType.RADIO; 
    6590        } 
    66  
     91         
     92        /** 
     93         * Merges a Parameter with this one if the type complies. 
     94         * @param aParameter The parameter to merge with the current one. 
     95         * @return True if they merged correctly, else false. 
     96         */ 
    6797        public boolean merge (final Parameter aParameter) { 
    6898                RadioParameter.logger.trace("merge"); 
  • org/w3c/unicorn/tasklist/parameters/TextAreaParameter.java

    r15 r89  
    1 // $Id: TextAreaParameter.java,v 1.2 2006-09-04 09:45:55 dleroy Exp $ 
     1// $Id: TextAreaParameter.java,v 1.3 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    1818        private Value aValueDefault; 
    1919 
     20        /** 
     21         * Default constructor for a TextAreaParameter  
     22         * (see the Parameter default constructor). 
     23         */ 
    2024        protected TextAreaParameter () { 
    2125                super(); 
     
    2327        } 
    2428 
     29        /** 
     30         * Adds a Value object to the mapOfValue. 
     31         *  @param aValue The value to add. 
     32         */ 
    2533        public void addValue (final Value aValue) { 
    2634                this.aValueDefault = aValue; 
     
    2937        /** 
    3038         * For velocity engine. 
    31          * @return 
     39         * @return The default value. 
    3240         */ 
    3341        public Value getDefaultValue () { 
     
    3543        } 
    3644 
     45        /** 
     46         * Finds a Value object in the map given its name. 
     47         *  @param sName The name of the Value. 
     48         *  @return The Value object if the String corresponds to a key. 
     49         */ 
    3750        public Value getValue (final String sName) { 
    3851                if (this.aValueDefault.getName().equals(sName)) { 
     
    5265        } 
    5366 
     67        /** 
     68         * Sets the default Value in the mapOfDefaultValue. 
     69         * @param sDefaultValues The new default value. 
     70         */ 
    5471        public void setDefaultValues (final String sDefaultValues) { 
    5572                this.aValueDefault.setName(sDefaultValues); 
     
    6582        } 
    6683 
     84        /** 
     85         * Defines or replaces the mapOfValue. 
     86         * @param mapOfValue The new map of values. 
     87         */ 
    6788        public void setMapOfValue (final Map<String, Value> mapOfValue) throws ParameterException { 
    6889                if (mapOfValue.size() != 1) { 
     
    7293        } 
    7394 
     95        /** 
     96         * Returns the type of the parameter. 
     97         * @return The type TEXTAREA. 
     98         */ 
    7499        public ParameterType getType () { 
    75100                return ParameterType.TEXTAREA; 
    76101        } 
    77  
     102         
     103        /** 
     104         * Merges a Parameter with this one if the type complies. 
     105         * @param aParameter The parameter to merge with the current one. 
     106         * @return True if they merged correctly, else false. 
     107         */ 
    78108        public boolean merge (final Parameter aParameter) { 
    79109                TextAreaParameter.logger.trace("merge"); 
  • org/w3c/unicorn/tasklist/parameters/TextFieldParameter.java

    r1 r89  
    1 // $Id: TextFieldParameter.java,v 1.1.1.1 2006-08-31 09:09:27 dleroy Exp $ 
     1// $Id: TextFieldParameter.java,v 1.2 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    1919        private Value aValueDefault; 
    2020 
     21        /** 
     22         * Default constructor for a TextFieldParameter  
     23         * (see the Parameter default constructor). 
     24         */ 
    2125        protected TextFieldParameter () { 
    2226                super(); 
     
    2428        } 
    2529 
     30        /** 
     31         * Adds a Value object to the mapOfValue. 
     32         *  @param aValue The value to add. 
     33         */ 
    2634        public void addValue (final Value aValue) { 
    2735                this.aValueDefault = aValue; 
    2836        } 
    2937 
     38        /** 
     39         * Finds a Value object in the map given its name. 
     40         *  @param sName The name of the Value. 
     41         *  @return The Value object if the String corresponds to a key. 
     42         */ 
    3043        public Value getValue (final String sName) { 
    3144                if (this.aValueDefault.getName().equals(sName)) { 
     
    4558        } 
    4659 
     60        /** 
     61         * Sets the default Value in the mapOfDefaultValue. 
     62         * @param sDefaultValues The new default value. 
     63         */ 
    4764        public void setDefaultValues (final String sDefaultValues) { 
    4865                this.aValueDefault.setName(sDefaultValues); 
     
    5774                return null; 
    5875        } 
    59  
     76         
     77        /** 
     78         * Defines or replaces the mapOfValue. 
     79         * @param mapOfValue The new map of values. 
     80         */ 
    6081        public void setMapOfValue (final Map<String, Value> mapOfValue) throws ParameterException { 
    6182                if (mapOfValue.size() != 1) { 
     
    6586                this.aValueDefault = mapOfValue.values().iterator().next(); 
    6687        } 
    67  
     88        /** 
     89         * Returns the type of the parameter. 
     90         * @return The type TEXTFIELD. 
     91         */ 
    6892        public ParameterType getType () { 
    6993                return ParameterType.TEXTFIELD; 
    7094        } 
    71  
     95         
     96        /** 
     97         * Merges a Parameter with this one if the type complies. 
     98         * @param aParameter The parameter to merge with the current one. 
     99         * @return True if they merged correctly, else false. 
     100         */ 
    72101        public boolean merge (final Parameter aParameter) { 
    73102                TextFieldParameter.logger.trace("merge"); 
  • org/w3c/unicorn/tasklist/parameters/Value.java

    r1 r89  
    1 // $Id: Value.java,v 1.1.1.1 2006-08-31 09:09:28 dleroy Exp $ 
     1// $Id: Value.java,v 1.2 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    9292        } 
    9393 
     94        /** 
     95         * Adds a list of mapping to the mapOfListOfMapping. 
     96         * @param sKey The key for the list. 
     97         * @param listOfMapping The list to add. 
     98         */ 
    9499        public void addListOfMapping (final String sKey, final List<Mapping> listOfMapping) { 
    95100                this.mapOfListOfMapping.put(sKey, listOfMapping); 
    96101        } 
    97102 
     103        /** 
     104         * Checks if the given mapping exists. 
     105         * @param sMapping  
     106         * @return True if the map contains sMapping, else false. 
     107         */ 
    98108        public boolean hasMapping (final String sMapping) { 
    99109                return null != this.mapOfListOfMapping.get(sMapping); 
    100110        } 
    101111 
     112        /** 
     113         * Finds a list of mapping given its name. 
     114         * @param sName The name of the mapping. 
     115         * @return The list of mapping if the name matches an entry. 
     116         */ 
    102117        public List<Mapping> getListOfMapping (final String sName) { 
    103118                return this.mapOfListOfMapping.get(sName); 
  • org/w3c/unicorn/tests/CommandLine.java

    r2 r89  
    1 // $Id: CommandLine.java,v 1.2 2006-09-01 14:30:17 dleroy Exp $ 
     1// $Id: CommandLine.java,v 1.3 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Damien LEROY. 
    33// (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. 
     
    3535 
    3636        /** 
     37         * Launches the Unicorn Framework. 
    3738         * @param args 
    3839         * @throws Exception  
  • org/w3c/unicorn/tests/ExpandTest.java

    r1 r89  
    1 // $Id: ExpandTest.java,v 1.1.1.1 2006-08-31 09:09:28 dleroy Exp $ 
     1// $Id: ExpandTest.java,v 1.2 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    2424        private List<String> references; 
    2525         
     26        /** 
     27         * Default constructor for ExpandTest. 
     28         * 
     29         */ 
    2630        public ExpandTest() { 
    2731                references = new ArrayList<String>(); 
    2832        } 
    2933         
     34        /** 
     35         * Removes the old references and updates the oldRefs list with the  
     36         * current references before adding the new references.  
     37         * 
     38         */ 
    3039        public void expand() { 
    3140                enCours = true; 
     
    5059        } 
    5160         
     61        /** 
     62         * Tests the expand process. 
     63         * @param args 
     64         */ 
    5265        public static void main(String[] args) {         
    5366                ExpandTest test1 = new ExpandTest(); 
    54                 //test1.references.add("test2"); 
    55                 //test1.references.add("test5"); 
    5667                test1.id = "css"; 
    5768                testList.put("css", test1); 
     
    6475                ExpandTest test3 = new ExpandTest(); 
    6576                test3.references.add("css"); 
    66                 //test3.references.add("test6"); 
    6777                test3.id = "foo"; 
    6878                testList.put("foo", test3); 
    69                 /* 
    70                 ExpandTest test4 = new ExpandTest(); 
    71                 test4.references.add("test1");   
    72                 test4.id = "test4"; 
    73                 testList.put("test4", test4); 
    74                  
    75                 ExpandTest test5 = new ExpandTest();     
    76                 test5.id = "test5"; 
    77                 test5.references.add("test6"); 
    78                 testList.put("test5", test5); 
    79                  
    80                 ExpandTest test6 = new ExpandTest();     
    81                 test6.id = "test6"; 
    82                 testList.put("test6", test6);*/ 
    83                 //test6.references.add("test4"); 
    8479                 
    8580                for (ExpandTest test : testList.values()) { 
    86                         //System.out.println(test.id); 
    8781                        test.expand(); 
    8882                } 
  • org/w3c/unicorn/tests/FirstServlet.java

    r80 r89  
    1 // $Id: FirstServlet.java,v 1.9 2008-02-21 14:30:53 hduong Exp $ 
     1// $Id: FirstServlet.java,v 1.10 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    5151        private static final Log logger = LogFactory.getLog("org.w3c.unicorn"); 
    5252 
     53        private static final long       serialVersionUID        = -1375355420965607571L; 
     54 
     55        private static final DiskFileItemFactory factory = new DiskFileItemFactory();    
     56         
    5357        /** 
    54          *  
    55          */ 
    56         private static final long       serialVersionUID        = -1375355420965607571L; 
    57  
    58         private static final DiskFileItemFactory factory = new DiskFileItemFactory();    
    59          
    60         // Create a new file upload handler 
     58         * Creates a new file upload handler. 
     59         */ 
    6160        private static final ServletFileUpload upload = new ServletFileUpload(FirstServlet.factory); 
    6261 
     
    321320        } 
    322321 
     322        /** 
     323         * Adds a parameter at the correct call. 
     324         * @param sParamName Name of the parameter. 
     325         * @param sParamValue Value of the parameter. 
     326         * @param aUnicornCall  
     327         * @param mapOfSpecificParameter 
     328         * @param mapOfOutputParameter 
     329         */ 
    323330        private void addParameter ( 
    324331                        final String sParamName, 
     
    331338        } 
    332339         
     340        /** 
     341         *  
     342         * @param sParamName 
     343         * @param tStringParamValue 
     344         * @param aUnicornCall 
     345         * @param mapOfSpecificParameter 
     346         * @param mapOfOutputParameter 
     347         */ 
    333348        private void addParameter ( 
    334349                        String sParamName, 
     
    473488        } 
    474489         
    475          
    476         /* 
     490        /** 
    477491         * This method returns the first language of the accept language list 
    478492         * which is equal to one of available index template language 
     493         *  
     494         * @param aLocale 
     495         * @return The selected language or the default language. 
    479496         */ 
    480497        private String chooseTemplateLang(String aLocale){ 
     
    490507        } 
    491508         
     509         
     510        /** 
     511         * Converts an Enumeration object to a string, the terms being 
     512         * separated by a coma. 
     513         * @param myEnum The enumeration to convert. 
     514         * @return The converted string. 
     515         */ 
    492516        private String convertEnumerationToString(Enumeration myEnum){ 
    493517                String ret = ""; 
  • org/w3c/unicorn/tests/HiepTest.java

    r30 r89  
    1414 
    1515        public static void main(String[] args) { 
    16  
    17                 /* 
    18                 // lang par defaut 
    19                 Map<String, String[]> mapOfParameter = new LinkedHashMap<String, String[]>(); 
    20                 String[] tmp = {"en"}; 
    21                 mapOfParameter.put("ucn_lang", tmp);  
    22                 aUnicornCall.setMapOfStringParameter(mapOfParameter); 
    23                 */ 
    2416                 
    2517                UnicornCall aUnicornCall = new UnicornCall(); 
  • org/w3c/unicorn/tests/JAXBTest.java

    r1 r89  
    1 // $Id: JAXBTest.java,v 1.1.1.1 2006-08-31 09:09:28 dleroy Exp $ 
     1// $Id: JAXBTest.java,v 1.2 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    2525                Unmarshaller u = jc.createUnmarshaller(); 
    2626                URL url = new URL("http://localhost:8001/css-validator/validator?uri=http%3A%2F%2Fforums.jeuxonline.info/clientscript/vbulletin_css/style-94bf45f8-00003.css&output=ucn"); 
    27                 //URL url = new URL("http://w3cstag8/~jean/xml/mess.xml"); 
    28                 //System.out.println(u.unmarshal(url.openStream()).getClass().getName()); 
    2927                Observationresponse obsres = (Observationresponse)u.unmarshal(url.openStream()); 
    3028                System.out.println(obsres.isPassed()); 
  • org/w3c/unicorn/tests/UnicornClient.java

    r78 r89  
    2121public class UnicornClient { 
    2222 
     23        /** 
     24         * Prints help contents on the standard output. 
     25         * 
     26         */ 
    2327        public static void print_help() { 
    2428                System.out.println("[Usage] UnicornClient task inputType=[mimetype=]pageToValid templateLanguage outputTemplate [otherParameters]"); 
     
    3539        } 
    3640         
     41        /** 
     42         * Tests Unicorn client. 
     43         * @param args 
     44         */ 
    3745        public static void main(String[] args) { 
    3846                UnicornCall aUnicornCall = new UnicornCall(); 
    39                  
    40                 /* 
    41                 String task = "css"; 
    42                 String pageToValid = "file=text/css=D:/stageW3C/unicorn/style/base_result.css"; 
    43                 String language = "en"; 
    44                 String outputTemplate = "text10"; 
    45                 String pParams=""; 
    46                 */ 
    47                  
    48                 /* 
    49                 String task = "css"; 
    50                 String pageToValid = "uri=http://w3.org"; 
    51                 String language = "en"; 
    52                 String outputTemplate = "xhtml20"; 
    53                 String pParams=""; 
    54                 */ 
    55                  
    56                 /* 
    57                 String task = "calculator"; 
    58                 String pageToValid = "uri=http://flyingman.sophia.w3.org/test"; 
    59                 String language = "fr"; 
    60                 String outputTemplate = "text10"; 
    61                 String pParams = "x2=on,ucn_lang=vn"; 
    62                 */ 
    63  
    64                 /* 
    65                 String task = "calculator"; 
    66                 String pageToValid = "file=text/plain=D:/stageW3C/tmp/test.txt"; 
    67                 String language = "en"; 
    68                 String outputTemplate = "text10"; 
    69                 String pParams = "x2=on,ucn_lang=fr"; 
    70                 */ 
    71                  
    7247                 
    7348                 
  • org/w3c/unicorn/tests/UnicornClientDirectInputTest.java

    r43 r89  
    2121        public static void main(String[] args) { 
    2222 
    23                 /* 
    24                 // lang par defaut 
    25                 Map<String, String[]> mapOfParameter = new LinkedHashMap<String, String[]>(); 
    26                 String[] tmp = {"en"}; 
    27                 mapOfParameter.put("ucn_lang", tmp);  
    28                 aUnicornCall.setMapOfStringParameter(mapOfParameter); 
    29                 */ 
    3023                 
    3124                UnicornCall aUnicornCall = new UnicornCall(); 
     
    4235 
    4336                aUnicornCall.setInputParameterValue("p#msie { /* msie-bug note for text/plain */ float: right; border: 1px solid black; background: white;}"); 
    44                  
    45                 //aUnicornCall.setInputParameterValue("2+3"); 
    46  
    47                  
    48                 //if (isAcceptDirectInput("calculator")) 
    4937                 
    5038                try { 
  • org/w3c/unicorn/util/ClientHttpRequest.java

    r32 r89  
    4040                ClientHttpRequest.randomString(); 
    4141 
     42         
     43        /** 
     44         * Connects to the output stream of the URLConnection. 
     45         * @throws IOException 
     46         */ 
    4247        private void connect () throws IOException { 
    4348                //ClientHttpRequest.logger.trace("connect"); 
     
    4752        } 
    4853 
     54        /** 
     55         * Writes a single character on the output stream. 
     56         * @param c The character to write. 
     57         * @throws IOException 
     58         */ 
    4959        private void write (final char c) throws IOException { 
    5060                this.connect(); 
     
    5363        } 
    5464 
     65        /** 
     66         * Writes a character string on the output stream. 
     67         * @param s The string to write. 
     68         * @throws IOException 
     69         */ 
    5570        protected void write (final String s) throws IOException { 
    5671                this.connect(); 
     
    5974        } 
    6075 
     76        /** 
     77         * Writes a new line on the output stream (carriage return). 
     78         * @throws IOException 
     79         */ 
    6180        protected void newline () throws IOException { 
    6281                this.connect(); 
     
    6483        } 
    6584 
     85        /** 
     86         * Writes a string and a new line on the output stream. 
     87         * @param s The string to write before the new line. 
     88         * @throws IOException 
     89         */ 
    6690        protected void writeln (final String s) throws IOException { 
    6791                this.connect(); 
     
    7094        } 
    7195 
     96        /** 
     97         * Computes a random string. 
     98         * @return A string containing a random long which radix is 36.  
     99         */ 
    72100        protected static String randomString () { 
    73101                return Long.toString(ClientHttpRequest.aRandom.nextLong(), 36); 
    74102        } 
    75103 
     104        /** 
     105         * Writes the sBoundary on the output, composed of three random strings. 
     106         * @throws IOException 
     107         */ 
    76108        private void boundary () throws IOException { 
    77109                this.write("--"); 
     
    160192        } 
    161193 
     194        /** 
     195         * Sets a new language.   
     196         * @param sLang The new language chosen. 
     197         */ 
    162198        public void setLang (final String sLang) { 
    163199                ClientHttpRequest.logger.debug("setLang("+sLang+")"); 
     
    165201        } 
    166202 
     203        /** 
     204         * Writes a name in the appropriate format on the output. 
     205         * @param sName The name to write. 
     206         * @throws IOException 
     207         */ 
    167208        private void writeName (final String sName) throws IOException { 
    168209                this.newline(); 
     
    193234        } 
    194235 
     236        /** 
     237         *  
     238         * @param aInputStream 
     239         * @param aOutputStream 
     240         * @throws IOException 
     241         */ 
    195242        private static void pipe ( 
    196243                        final InputStream aInputStream, 
  • org/w3c/unicorn/util/LocaleFactory.java

    r1 r89  
    1 // $Id: LocaleFactory.java,v 1.1.1.1 2006-08-31 09:09:28 dleroy Exp $ 
     1// $Id: LocaleFactory.java,v 1.2 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    1818        private static final LinkedHashMap<String, Locale> mapOfLocale = new LinkedHashMap<String, Locale>(); 
    1919 
     20        /** 
     21         * Finds a Locale object among the mapOfLocale entries, given its name. 
     22         * @param sLocale The name of the Locale. 
     23         * @return The corresponding Locale object. 
     24         */ 
    2025        public static Locale getLocale (final String sLocale) { 
    2126                return LocaleFactory.mapOfLocale.get(sLocale); 
    2227        } 
    2328 
     29        /** 
     30         * Returns the values available in the mapOfLocale. 
     31         * @return The collection of values. 
     32         */ 
    2433        public static Collection<Locale> values () { 
    2534                return LocaleFactory.mapOfLocale.values(); 
  • org/w3c/unicorn/util/LocalizedString.java

    r81 r89  
    1 // $Id: LocalizedString.java,v 1.4 2008-04-18 12:35:22 jean-gui Exp $ 
     1// $Id: LocalizedString.java,v 1.5 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    2525        private Map<String, String> mapOfString = null; 
    2626 
     27        /** 
     28         * Default constructor for LocalizedString. 
     29         * 
     30         */ 
    2731        public LocalizedString () { 
    2832                LocalizedString.logger.trace("Constructor"); 
     
    3034        } 
    3135 
     36        /** 
     37         * Constructs a LocalizedString with an initial string paired with a language. 
     38         * @param s The string to be localized. 
     39         * @param lang The corresponding language. 
     40         */ 
    3241        public LocalizedString (String s, String lang) { 
    3342                this(); 
     
    3544        } 
    3645         
     46        /** 
     47         * Looks for the existence of a specified sLocale string in the map. 
     48         * @param sLocale The string to look for. 
     49         * @return True if the sLocale string is in the map, else false. 
     50         */ 
    3751        public boolean hasLocale (final String sLocale) { 
    3852                return null != this.mapOfString.get(sLocale); 
    3953        } 
    4054 
     55        /** 
     56         * Adds a message and its corresponding localization  
     57         * to the mapOfString attribute. 
     58         * @param sLocale The localization. 
     59         * @param sMessage The message to be written. 
     60         * @return The previous value associated with 
     61         *  specified key, or null if there was no mapping for key. 
     62         */ 
    4163        public String addLocalization ( 
    4264                        final String sLocale, 
     
    5072        } 
    5173 
     74        /** 
     75         * Finds and returns the message corresponding to the specified 
     76         * localization in the mapOfString. 
     77         * @param sLocale The localization wanted. 
     78         * @return The message corresponding to the localization 
     79         * or if there's none, the one corresponding to the default language. 
     80         */ 
    5281        public String getLocalization (final String sLocale) { 
    5382                final String sMessage = this.mapOfString.get(sLocale); 
     
    5887        } 
    5988 
     89        /** 
     90         * Returns the keys available in the mapOfString. 
     91         * @return A set with all the keys. 
     92         */ 
    6093        public Set<String> getSetOfLocale () { 
    6194                return this.mapOfString.keySet(); 
    6295        } 
    6396 
    64         // return the message in DEFAULT_LANGUAGE (en) or in the first language in 
    65         // the list 
     97        /** 
     98         * Returns the message in in DEFAULT_LANGUAGE (en) or in the first language 
     99         * in the list.  
     100         */ 
    66101        public String toString () { 
    67102                String res = this.mapOfString.get(LocalizedString.DEFAULT_LANGUAGE); 
  • org/w3c/unicorn/util/Property.java

    r81 r89  
    1 // $Id: Property.java,v 1.2 2008-04-18 12:35:22 jean-gui Exp $ 
     1// $Id: Property.java,v 1.3 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Damien LEROY. 
    33// (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. 
     
    2525        private static final Map<String, Property> mapOfProperty = new Hashtable<String, Property>(); 
    2626 
     27        /** 
     28         * Adds a Property object to the static mapOfProperty. 
     29         * @param aProperty The Property to be add. 
     30         */ 
    2731        private static void addProperty (final Property aProperty) { 
    2832                Property.logger.trace("addProperty"); 
     
    3438        } 
    3539 
     40        /** 
     41         * Finds a Property in the map given its ID. 
     42         * @param sID The ID of the Property wanted. 
     43         * @return The corresponding Property object  
     44         * or null if there's none.  
     45         */ 
    3646        public static Property getProperty (final String sID) { 
    3747                return Property.mapOfProperty.get(sID); 
    3848        } 
    3949 
     50        /** 
     51         * Gets the value of a Property in the map given its ID. 
     52         * @param sID The ID of the Property wanted. 
     53         * @return The value of the corresponding Property 
     54         * or null if there's none. 
     55         */ 
    4056        public static String get (final String sID) { 
    4157                return Property.mapOfProperty.get(sID).getValue(); 
    4258        } 
    4359 
     60        /** 
     61         * Adds the given properties in the map. 
     62         * @param aProperties The properties to be loaded. 
     63         */ 
    4464        public static void load (final Properties aProperties) { 
    4565                Property.logger.trace("load"); 
     
    5373        } 
    5474 
     75        /** 
     76         * Adds a Property in the map with the given name and value. 
     77         * @param sPropName The name of the Property. 
     78         * @param sPropValue The value of the Property. 
     79         */ 
    5580        private static void parseValue (final String sPropName, final String sPropValue) { 
    5681                Property.logger.trace("parseValue"); 
     
    101126        private String sID = null; 
    102127 
     128        /** 
     129         * Gives the ID of the current Property. 
     130         * @return The ID of the Property. 
     131         */ 
    103132        private String getID () { 
    104133                return this.sID; 
    105134        } 
    106135 
     136        /** 
     137         * Sets the ID of the Property. 
     138         * @param sID The ID to set. 
     139         */ 
    107140        private void setID (final String sID) { 
    108141                this.sID = sID; 
    109142        } 
    110143 
     144        /** 
     145         * Adds a Property to the listOfElement. 
     146         * @param aProperty The property to add. 
     147         */ 
    111148        private void addElement (final Property aProperty) { 
    112149                this.listOfElement.add(aProperty); 
    113150        } 
    114151         
     152        /** 
     153         * Erases the contents of listOfElement. 
     154         * 
     155         */ 
    115156        public void clear () { 
    116157                this.listOfElement.clear(); 
     
    118159        } 
    119160         
     161        /** 
     162         * Sets a specific element in the list. 
     163         * @param sSpecific The name of the specific element. 
     164         */ 
    120165        public void setSpecific (final String sSpecific) { 
    121166                this.sSpecificElement = sSpecific; 
    122167        } 
    123168 
     169        /** 
     170         * Gives the value of the Property. 
     171         * @return The value of the Property. 
     172         */ 
    124173        public String getValue () { 
    125174                final int iStringBufferSize = 500; 
     
    162211        } 
    163212 
     213        /** 
     214         * For each Property in the map, prints its ID and value. 
     215         * @param tArgument 
     216         */ 
    164217        public static void main (final String[] tArgument) { 
    165218                System.out.println("Begin."); 
  • org/w3c/unicorn/util/Unmarshaller.java

    r1 r89  
    1 // $Id: Unmarshaller.java,v 1.1.1.1 2006-08-31 09:09:28 dleroy Exp $ 
     1// $Id: Unmarshaller.java,v 1.2 2008-06-17 13:45:31 jbarouh Exp $ 
    22// Author: Damien LEROY. 
    33// (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. 
     
    1919 
    2020        public void addURL (final URL aURL) throws IOException, JAXBException, SAXException; 
     21 
    2122        public void unmarshal () throws Exception; 
    2223 
  • org/w3c/unicorn/util/unicorn.properties

    r81 r89  
    11 
    2 UNICORN_URL = http://localhost:8180/unicorn/ 
    3 UNICORN_HOME = /var/lib/tomcat55/webapps/unicorn/ 
     2UNICORN_URL = http://localhost:8080/unicorn/ 
     3UNICORN_HOME = D:\barouh\Tomcat 6.0\webapps\unicorn 
    44UNICORN_ENCODING = UTF-8 
    55