Changeset 89:b4b323be9768
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r71
|
r89
|
|
| 41 | 41 | protected String lang; |
| 42 | 42 | |
| | 43 | /** |
| | 44 | * |
| | 45 | * @return The list of the contents. |
| | 46 | */ |
| 43 | 47 | public List<Object> getContent() { |
| 44 | 48 | if (content == null) { |
| … |
… |
|
| 48 | 52 | } |
| 49 | 53 | |
| | 54 | /** |
| | 55 | * Sets the contents of the message. |
| | 56 | * @param content The list to set. |
| | 57 | */ |
| 50 | 58 | public void setContent(List<Object> content) { |
| 51 | 59 | this.content = content; |
| … |
… |
|
| 61 | 69 | } |
| 62 | 70 | */ |
| | 71 | /** |
| | 72 | * @return The language of the message. |
| | 73 | */ |
| 63 | 74 | public String getLang() { |
| 64 | 75 | return lang; |
| 65 | 76 | } |
| 66 | 77 | |
| | 78 | /** |
| | 79 | * Sets the language for this message. |
| | 80 | * @param lang The language of the message. |
| | 81 | */ |
| 67 | 82 | public void setLang(String lang) { |
| 68 | 83 | this.lang = lang; |
-
|
r71
|
r89
|
|
| 159 | 159 | } |
| 160 | 160 | |
| | 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 | */ |
| 161 | 167 | public Result getResult(String lang, String uri) { |
| 162 | 168 | if (mapOfLangURIResult.get(lang)==null) |
| … |
… |
|
| 168 | 174 | |
| 169 | 175 | /** |
| 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 |
| 171 | 177 | * 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. |
| 173 | 180 | */ |
| 174 | 181 | public void addResult(Result value) { |
| … |
… |
|
| 187 | 194 | } |
| 188 | 195 | |
| | 196 | /** |
| | 197 | * |
| | 198 | * @return The list of errors corresponding to the results. |
| | 199 | */ |
| 189 | 200 | List<Error> getErrorList() { |
| 190 | 201 | List<Error> xList = new ArrayList<Error>(); |
| … |
… |
|
| 199 | 210 | } |
| 200 | 211 | |
| | 212 | /** |
| | 213 | * |
| | 214 | * @return The list of warnings corresponding to the results. |
| | 215 | */ |
| 201 | 216 | List<Warning> getWarningList() { |
| 202 | 217 | List<Warning> xList = new ArrayList<Warning>(); |
| … |
… |
|
| 211 | 226 | } |
| 212 | 227 | |
| | 228 | /** |
| | 229 | * |
| | 230 | * @return The list of infos corresponding to the results. |
| | 231 | */ |
| 213 | 232 | List<Info> getAllInfo() { |
| 214 | 233 | List<Info> xList = new ArrayList<Info>(); |
-
|
r71
|
r89
|
|
| 11 | 11 | protected List<Info> infos = new ArrayList<Info>(); |
| 12 | 12 | |
| | 13 | /** |
| | 14 | * Constructor for Result. |
| | 15 | * @param lang The language to consider. |
| | 16 | * @param uri The URI to consider. |
| | 17 | */ |
| 13 | 18 | public Result(String lang, String uri) { |
| 14 | 19 | super(); |
| … |
… |
|
| 16 | 21 | this.lang = lang; |
| 17 | 22 | } |
| | 23 | |
| | 24 | /** |
| | 25 | * |
| | 26 | * @return The URI of the result. |
| | 27 | */ |
| 18 | 28 | public String getUri() { |
| 19 | 29 | return uri; |
| 20 | 30 | } |
| | 31 | |
| | 32 | /** |
| | 33 | * |
| | 34 | * @return The list of errors. |
| | 35 | */ |
| 21 | 36 | public List<Error> getErrors() { |
| 22 | 37 | return errors; |
| 23 | 38 | } |
| | 39 | |
| | 40 | /** |
| | 41 | * |
| | 42 | * @return The list of warnings. |
| | 43 | */ |
| 24 | 44 | public List<Warning> getWarnings() { |
| 25 | 45 | return warnings; |
| 26 | 46 | } |
| | 47 | |
| | 48 | /** |
| | 49 | * |
| | 50 | * @return The list of infos. |
| | 51 | */ |
| 27 | 52 | public List<Info> getInfos() { |
| 28 | 53 | return infos; |
| 29 | 54 | } |
| | 55 | |
| | 56 | /** |
| | 57 | * |
| | 58 | * @return The language of the result. |
| | 59 | */ |
| 30 | 60 | public String getLang() { |
| 31 | 61 | return lang; |
-
|
r71
|
r89
|
|
| 29 | 29 | import org.w3c.unicorn.util.LocalizedString; |
| 30 | 30 | |
| | 31 | /** |
| | 32 | * Default parser class. |
| | 33 | * |
| | 34 | */ |
| 31 | 35 | public 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 | |
| 33 | 39 | private static JAXBContext aJAXBContext = null; |
| | 40 | |
| 34 | 41 | private static Unmarshaller aUnmarshaller = null; |
| 35 | | |
| | 42 | |
| 36 | 43 | static { |
| 37 | 44 | try { |
| 38 | | aJAXBContext = JAXBContext.newInstance("org.w3c.unicorn.generated.observationresponse"); |
| | 45 | aJAXBContext = JAXBContext |
| | 46 | .newInstance("org.w3c.unicorn.generated.observationresponse"); |
| 39 | 47 | aUnmarshaller = aJAXBContext.createUnmarshaller(); |
| 40 | | } |
| 41 | | catch (final JAXBException e) { |
| | 48 | } catch (final JAXBException e) { |
| 42 | 49 | logger.error("JAXBException : " + e.getMessage(), e); |
| 43 | 50 | e.printStackTrace(); |
| 44 | 51 | } |
| 45 | 52 | } |
| 46 | | |
| | 53 | |
| | 54 | /** |
| | 55 | * Parses the input and returns the response. |
| | 56 | * @param inputStream The input stream. |
| | 57 | * @return The corresponding response. |
| | 58 | */ |
| 47 | 59 | public Response parse(InputStream inputStream) { |
| 48 | 60 | try { |
| 49 | | return swap((Observationresponse)(aUnmarshaller.unmarshal(inputStream))); |
| | 61 | return swap((Observationresponse) (aUnmarshaller |
| | 62 | .unmarshal(inputStream))); |
| 50 | 63 | } catch (JAXBException e) { |
| 51 | 64 | logger.error("JAXBException : " + e.getMessage(), e); |
| … |
… |
|
| 54 | 67 | } |
| 55 | 68 | } |
| 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 | */ |
| 57 | 77 | private List<LocalizedString> swapListMessage(List<String> x, String lang) { |
| 58 | 78 | List<LocalizedString> y = new ArrayList<LocalizedString>(); |
| 59 | 79 | for (Object ox : x) { |
| 60 | | String cox = (String)ox; |
| | 80 | String cox = (String) ox; |
| 61 | 81 | LocalizedString coy = new LocalizedString(cox, lang); |
| 62 | 82 | y.add(coy); |
| … |
… |
|
| 65 | 85 | } |
| 66 | 86 | |
| | 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 | */ |
| 67 | 94 | private List<Object> swap(List<Object> x, String lang) { |
| 68 | 95 | List<Object> y = new ArrayList<Object>(); |
| 69 | 96 | for (Object ox : x) { |
| 70 | 97 | if (ox instanceof String) { |
| 71 | | String cox = (String)ox; |
| | 98 | String cox = (String) ox; |
| 72 | 99 | LocalizedString coy = new LocalizedString(cox, lang); |
| 73 | 100 | 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; |
| 77 | 103 | A coy = new A(); |
| 78 | 104 | coy.setHref(cox.getHref()); |
| 79 | 105 | coy.setContent(swap(cox.getContent(), lang)); |
| 80 | 106 | 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; |
| 84 | 109 | Code coy = new Code(); |
| 85 | 110 | coy.setContent(swap(cox.getContent(), lang)); |
| 86 | 111 | 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; |
| 90 | 114 | Img coy = new Img(); |
| 91 | 115 | coy.setAlt(cox.getAlt()); |
| … |
… |
|
| 100 | 124 | return y; |
| 101 | 125 | } |
| 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) { |
| 104 | 136 | 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) { |
| 110 | 151 | List<Longmessage> y = new ArrayList<Longmessage>(); |
| 111 | 152 | 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; |
| 113 | 154 | Longmessage coy = swap(cox, lang); |
| 114 | 155 | y.add(coy); |
| … |
… |
|
| 117 | 158 | } |
| 118 | 159 | |
| 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) { |
| 120 | 168 | Warning y = new Warning(); |
| 121 | 169 | y.setLine(x.getLine()); |
| … |
… |
|
| 128 | 176 | } |
| 129 | 177 | |
| 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) { |
| 131 | 186 | Error y = new Error(); |
| 132 | 187 | y.setLine(x.getLine()); |
| … |
… |
|
| 138 | 193 | return y; |
| 139 | 194 | } |
| 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) { |
| 142 | 204 | Info y = new Info(); |
| 143 | 205 | y.setLine(x.getLine()); |
| … |
… |
|
| 148 | 210 | return y; |
| 149 | 211 | } |
| 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 | */ |
| 151 | 219 | private Response swap(Observationresponse or) { |
| 152 | 220 | Response res = new Response(); |
| … |
… |
|
| 156 | 224 | res.setDate(or.getDate()); |
| 157 | 225 | 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) { |
| 162 | 231 | Warnings warnings = rrr.getWarnings(); |
| 163 | | if (warnings!=null && warnings.getWarninglist()!=null) { |
| | 232 | if (warnings != null && warnings.getWarninglist() != null) { |
| 164 | 233 | for (Warninglist wl : warnings.getWarninglist()) { |
| 165 | 234 | String lang = warnings.getLang(); |
| 166 | 235 | 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()) { |
| 168 | 238 | r.getWarnings().add(swap(w, lang)); |
| 169 | 239 | } |
| … |
… |
|
| 171 | 241 | } |
| 172 | 242 | } |
| 173 | | |
| | 243 | |
| 174 | 244 | Errors errors = rrr.getErrors(); |
| 175 | | if (errors!=null && errors.getErrorlist()!=null) { |
| | 245 | if (errors != null && errors.getErrorlist() != null) { |
| 176 | 246 | for (Errorlist wl : errors.getErrorlist()) { |
| 177 | 247 | 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()) { |
| 180 | 251 | r.getErrors().add(swap(w, lang)); |
| 181 | 252 | } |
| 182 | 253 | res.addResult(r); |
| 183 | | } |
| 184 | | } |
| 185 | | |
| | 254 | } |
| | 255 | } |
| | 256 | |
| 186 | 257 | Informations informations = rrr.getInformations(); |
| 187 | | if (informations!=null && informations.getInfolist()!=null) { |
| | 258 | if (informations != null && informations.getInfolist() != null) { |
| 188 | 259 | String lang = informations.getLang(); |
| 189 | 260 | for (Infolist wl : informations.getInfolist()) { |
| 190 | 261 | 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()) { |
| 192 | 264 | r.getInfos().add(swap(w, lang)); |
| 193 | 265 | } |
| … |
… |
|
| 196 | 268 | } |
| 197 | 269 | } |
| 198 | | |
| 199 | | |
| | 270 | |
| 200 | 271 | return res; |
| 201 | 272 | } |
| 202 | | |
| | 273 | |
| 203 | 274 | } |
-
|
r71
|
r89
|
|
| 10 | 10 | import org.xml.sax.SAXException; |
| 11 | 11 | |
| | 12 | /** |
| | 13 | * Factory to create ResponseParsers |
| | 14 | * |
| | 15 | */ |
| 12 | 16 | public 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 | */ |
| 13 | 26 | public static ResponseParser createResponseParser(String responseType) throws SAXException, ParserConfigurationException, IOException { |
| 14 | 27 | ResponseParser rsp = Framework.mapOfReponseParser.get(responseType); |
| … |
… |
|
| 18 | 31 | } |
| 19 | 32 | |
| | 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 | */ |
| 20 | 40 | public static Response parse(InputStream is, String responseType) { |
| 21 | 41 | try { |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 117 | 117 | } |
| 118 | 118 | |
| | 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 | */ |
| 119 | 125 | public boolean allowMimeType ( |
| 120 | 126 | final MimeType aMimeType) { |
-
|
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 $ |
| 2 | 2 | // Author: Damien LEROY. |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. |
| … |
… |
|
| 86 | 86 | private Model aModel = null; |
| 87 | 87 | |
| | 88 | /** |
| | 89 | * Default constructor. |
| | 90 | * |
| | 91 | */ |
| 88 | 92 | public RDFUnmarshallerJena () { |
| 89 | 93 | RDFUnmarshallerJena.logger.trace("Constructor"); |
| … |
… |
|
| 91 | 95 | } |
| 92 | 96 | |
| | 97 | /** |
| | 98 | * Adds a Model with the given URL to this aModel. |
| | 99 | * @param aURL The URL to add. |
| | 100 | */ |
| 93 | 101 | public void addURL (final URL aURL) throws IOException { |
| 94 | 102 | RDFUnmarshallerJena.logger.trace("addURL"); |
| … |
… |
|
| 101 | 109 | } |
| 102 | 110 | |
| | 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 | */ |
| 103 | 116 | private void addLongName (final Task aTask, final Literal aLiteral) { |
| 104 | 117 | RDFUnmarshallerJena.logger.debug( |
| … |
… |
|
| 108 | 121 | } |
| 109 | 122 | |
| | 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 | */ |
| 110 | 128 | private void addDescription (final Task aTask, final Literal aLiteral) { |
| 111 | 129 | RDFUnmarshallerJena.logger.debug( |
| … |
… |
|
| 115 | 133 | } |
| 116 | 134 | |
| | 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 | */ |
| 117 | 140 | private void addLongName (final Parameter aParameter, final Literal aLiteral) { |
| 118 | 141 | RDFUnmarshallerJena.logger.debug( |
| … |
… |
|
| 122 | 145 | } |
| 123 | 146 | |
| | 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 | */ |
| 124 | 152 | private void addLongName (final Value aValue, final Literal aLiteral) { |
| 125 | 153 | RDFUnmarshallerJena.logger.debug( |
| … |
… |
|
| 129 | 157 | } |
| 130 | 158 | |
| | 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 | */ |
| 131 | 164 | private void addMapping (final Value aValue, final Resource aMapping) { |
| 132 | 165 | RDFUnmarshallerJena.logger.trace("addMapping"); |
| … |
… |
|
| 145 | 178 | } |
| 146 | 179 | |
| | 180 | /** |
| | 181 | * Adds a value to the given parameter. |
| | 182 | * @param aParameter The parameter to consider. |
| | 183 | * @param aValue The value to add. |
| | 184 | */ |
| 147 | 185 | private void addValue (final Parameter aParameter, final Resource aValue) { |
| 148 | 186 | final String sValue = |
| … |
… |
|
| 175 | 213 | } |
| 176 | 214 | |
| | 215 | /** |
| | 216 | * Adds a parameter to the given task. |
| | 217 | * @param aTask The task to consider. |
| | 218 | * @param aParameter The parameter to add. |
| | 219 | */ |
| 177 | 220 | private void addParameter (final Task aTask, final Resource aParameter) { |
| 178 | 221 | final String sParameterReference = |
| … |
… |
|
| 210 | 253 | } |
| 211 | 254 | |
| | 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 | */ |
| 212 | 261 | private void addHandler (final Task aTask, final Resource aHandler) throws MimeTypeParseException { |
| 213 | 262 | RDFUnmarshallerJena.logger.trace("addHandler"); |
| … |
… |
|
| 226 | 275 | } |
| 227 | 276 | |
| | 277 | /** |
| | 278 | * Adds a task to this object. |
| | 279 | * @param aTask The task to add. |
| | 280 | * @throws Exception |
| | 281 | */ |
| 228 | 282 | private void addTask (final Resource aTask) throws Exception { |
| 229 | 283 | final Statement aReference = aTask.getProperty(RDFUnmarshallerJena.PROPERTY_REFERENCE); |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 538 | 538 | } |
| 539 | 539 | |
| 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 | |
| 567 | 541 | |
| 568 | 542 | } |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 18 | 18 | private Map<String, Value> mapOfDefaultValue; |
| 19 | 19 | |
| | 20 | /** |
| | 21 | * Default constructor for a CheckboxListParameter |
| | 22 | * (see Parameter default constructor). |
| | 23 | */ |
| 20 | 24 | protected CheckboxListParameter () { |
| 21 | 25 | super(); |
| … |
… |
|
| 23 | 27 | } |
| 24 | 28 | |
| | 29 | /** |
| | 30 | * Adds a Value object to the mapOfValue. |
| | 31 | * @param aValue The value to add. |
| | 32 | */ |
| 25 | 33 | public void addValue (final Value aValue) { |
| 26 | 34 | this.mapOfValue.put(aValue.getName(), aValue); |
| 27 | 35 | } |
| 28 | 36 | |
| | 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 | */ |
| 29 | 42 | public Value getValue (final String sName) { |
| 30 | 43 | return this.mapOfValue.get(sName); |
| … |
… |
|
| 39 | 52 | } |
| 40 | 53 | |
| | 54 | /** |
| | 55 | * Sets the default Value in the mapOfDefaultValue. |
| | 56 | * @param sDefaultValues The new default value. |
| | 57 | */ |
| 41 | 58 | public void setDefaultValues (final String sDefaultValues) { |
| 42 | 59 | this.mapOfDefaultValue = new LinkedHashMap<String, Value>(); |
| … |
… |
|
| 63 | 80 | } |
| 64 | 81 | |
| | 82 | /** |
| | 83 | * Defines or replaces the mapOfValue. |
| | 84 | * @param mapOfValue The new map of values. |
| | 85 | */ |
| 65 | 86 | public void setMapOfValue (final Map<String, Value> mapOfValue) { |
| 66 | 87 | this.mapOfValue = mapOfValue; |
| 67 | 88 | } |
| 68 | 89 | |
| | 90 | /** |
| | 91 | * Returns the type of the parameter. |
| | 92 | * @return The type CHECKBOXLIST. |
| | 93 | */ |
| 69 | 94 | public ParameterType getType () { |
| 70 | 95 | return ParameterType.CHECKBOXLIST; |
| 71 | 96 | } |
| 72 | 97 | |
| | 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 | */ |
| 73 | 103 | public boolean merge (final Parameter aParameter) { |
| 74 | 104 | CheckboxListParameter.logger.trace("merge"); |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 19 | 19 | private Map<String, Value> mapOfValue = null; |
| 20 | 20 | |
| | 21 | /** |
| | 22 | * Default constructor for a CheckboxParameter |
| | 23 | * (see the Parameter default constructor). |
| | 24 | */ |
| 21 | 25 | protected CheckboxParameter () { |
| 22 | 26 | super(); |
| … |
… |
|
| 24 | 28 | } |
| 25 | 29 | |
| | 30 | /** |
| | 31 | * Adds a Value object to the mapOfValue. |
| | 32 | * @param aValue The value to add. |
| | 33 | */ |
| 26 | 34 | public void addValue (final Value aValue) { |
| 27 | 35 | this.mapOfValue.put(aValue.getName(), aValue); |
| 28 | 36 | } |
| 29 | 37 | |
| | 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 | */ |
| 30 | 43 | public Value getValue (final String sName) { |
| 31 | 44 | return this.mapOfValue.get(sName); |
| … |
… |
|
| 43 | 56 | } |
| 44 | 57 | |
| | 58 | /** |
| | 59 | * Sets the default Value in the mapOfDefaultValue. |
| | 60 | * @param sDefaultValues The new default value. |
| | 61 | */ |
| 45 | 62 | public void setDefaultValues (final String sDefaultValues) { |
| 46 | 63 | this.bCheckedByDefault = ( |
| … |
… |
|
| 56 | 73 | } |
| 57 | 74 | |
| | 75 | /** |
| | 76 | * Defines or replaces the mapOfValue. |
| | 77 | * @param mapOfValue The new map of values. |
| | 78 | */ |
| 58 | 79 | public void setMapOfValue (final Map<String, Value> mapOfValue) throws ParameterException { |
| 59 | 80 | if (mapOfValue.size() > 2 || mapOfValue.size() < 1) { |
| … |
… |
|
| 68 | 89 | } |
| 69 | 90 | /** |
| 70 | | * @return Returns the checked. |
| | 91 | * Gets the checked Value in the mapOfValue. |
| | 92 | * @return Returns the checked Value. |
| 71 | 93 | */ |
| 72 | 94 | public Value getChecked () { |
| … |
… |
|
| 75 | 97 | |
| 76 | 98 | /** |
| 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. |
| 78 | 102 | */ |
| 79 | 103 | public void setChecked (final Value aValueChecked) { |
| … |
… |
|
| 82 | 106 | |
| 83 | 107 | /** |
| | 108 | * Gets the unchecked Value in the mapOfValue. |
| 84 | 109 | * @return Returns the unchecked. |
| 85 | 110 | */ |
| … |
… |
|
| 89 | 114 | |
| 90 | 115 | /** |
| 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. |
| 92 | 119 | */ |
| 93 | 120 | public void setUnchecked (final Value aValueUnchecked) { |
| … |
… |
|
| 95 | 122 | } |
| 96 | 123 | |
| | 124 | /** |
| | 125 | * Returns the type of the parameter. |
| | 126 | * @return The type CHECKBOX. |
| | 127 | */ |
| 97 | 128 | public ParameterType getType () { |
| 98 | 129 | return ParameterType.CHECKBOX; |
| 99 | 130 | } |
| 100 | 131 | |
| | 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 | */ |
| 101 | 137 | public boolean merge (final Parameter aParameter) { |
| 102 | 138 | CheckboxParameter.logger.trace("merge"); |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 20 | 20 | private Value aValueDefault; |
| 21 | 21 | |
| | 22 | /** |
| | 23 | * Default constructor for a DropDownParameter |
| | 24 | * (see the Parameter default constructor). |
| | 25 | */ |
| 22 | 26 | protected DropDownParameter () { |
| 23 | 27 | super(); |
| … |
… |
|
| 25 | 29 | } |
| 26 | 30 | |
| | 31 | /** |
| | 32 | * Adds a Value object to the mapOfValue. |
| | 33 | * @param aValue The value to add. |
| | 34 | */ |
| 27 | 35 | public void addValue (final Value aValue) { |
| 28 | 36 | this.mapOfValue.put(aValue.getName(), aValue); |
| 29 | 37 | } |
| 30 | 38 | |
| | 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 | */ |
| 31 | 44 | public Value getValue (final String sName) { |
| 32 | 45 | return this.mapOfValue.get(sName); |
| … |
… |
|
| 43 | 56 | } |
| 44 | 57 | |
| | 58 | /** |
| | 59 | * Sets the default Value in the mapOfDefaultValue. |
| | 60 | * @param sDefaultValues The new default value. |
| | 61 | */ |
| 45 | 62 | public void setDefaultValues (final String sDefaultValues) { |
| 46 | 63 | this.aValueDefault = this.mapOfValue.get(sDefaultValues); |
| … |
… |
|
| 55 | 72 | } |
| 56 | 73 | |
| | 74 | /** |
| | 75 | * Defines or replaces the mapOfValue. |
| | 76 | * @param mapOfValue The new map of values. |
| | 77 | */ |
| 57 | 78 | public void setMapOfValue (final Map<String, Value> mapOfValue) throws ParameterException { |
| 58 | 79 | if (mapOfValue.size() < 1) { |
| … |
… |
|
| 63 | 84 | } |
| 64 | 85 | |
| | 86 | /** |
| | 87 | * Returns the type of the parameter. |
| | 88 | * @return The type DROPDOWN. |
| | 89 | */ |
| 65 | 90 | public ParameterType getType () { |
| 66 | 91 | return ParameterType.DROPDOWN; |
| 67 | 92 | } |
| 68 | 93 | |
| | 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 | */ |
| 69 | 99 | public boolean merge (final Parameter aParameter) { |
| 70 | 100 | DropDownParameter.logger.trace("merge"); |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 139 | 139 | aStringBuffer.append(this.aObserver.getID()); |
| 140 | 140 | aStringBuffer.append('.'); |
| 141 | | //aStringBuffer.append(this.listOfEnumInputMethod); |
| 142 | 141 | aStringBuffer.append('.'); |
| 143 | 142 | aStringBuffer.append(this.sParam); |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 19 | 19 | private Value aValueDefault; |
| 20 | 20 | |
| | 21 | /** |
| | 22 | * Default constructor for a RadioParameter |
| | 23 | * (see the Parameter default constructor). |
| | 24 | */ |
| 21 | 25 | protected RadioParameter () { |
| 22 | 26 | super(); |
| … |
… |
|
| 24 | 28 | } |
| 25 | 29 | |
| | 30 | /** |
| | 31 | * Adds a Value object to the mapOfValue. |
| | 32 | * @param aValue The value to add. |
| | 33 | */ |
| 26 | 34 | public void addValue (final Value aValue) { |
| 27 | 35 | this.mapOfValue.put(aValue.getName(), aValue); |
| 28 | 36 | } |
| 29 | 37 | |
| | 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 | */ |
| 30 | 43 | public Value getValue (final String sName) { |
| 31 | 44 | return this.mapOfValue.get(sName); |
| … |
… |
|
| 42 | 55 | } |
| 43 | 56 | |
| | 57 | /** |
| | 58 | * Sets the default Value in the mapOfDefaultValue. |
| | 59 | * @param sDefaultValues The new default value. |
| | 60 | */ |
| 44 | 61 | public void setDefaultValues (final String sDefaultValues) { |
| 45 | 62 | this.aValueDefault = this.mapOfValue.get(sDefaultValues); |
| … |
… |
|
| 54 | 71 | } |
| 55 | 72 | |
| | 73 | /** |
| | 74 | * Defines or replaces the mapOfValue. |
| | 75 | * @param mapOfValue The new map of values. |
| | 76 | */ |
| 56 | 77 | public void setMapOfValue (final Map<String, Value> mapOfValue) throws ParameterException { |
| 57 | 78 | if (mapOfValue.size() == 0) { |
| … |
… |
|
| 61 | 82 | } |
| 62 | 83 | |
| | 84 | /** |
| | 85 | * Returns the type of the parameter. |
| | 86 | * @return The type RADIO. |
| | 87 | */ |
| 63 | 88 | public ParameterType getType () { |
| 64 | 89 | return ParameterType.RADIO; |
| 65 | 90 | } |
| 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 | */ |
| 67 | 97 | public boolean merge (final Parameter aParameter) { |
| 68 | 98 | RadioParameter.logger.trace("merge"); |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 18 | 18 | private Value aValueDefault; |
| 19 | 19 | |
| | 20 | /** |
| | 21 | * Default constructor for a TextAreaParameter |
| | 22 | * (see the Parameter default constructor). |
| | 23 | */ |
| 20 | 24 | protected TextAreaParameter () { |
| 21 | 25 | super(); |
| … |
… |
|
| 23 | 27 | } |
| 24 | 28 | |
| | 29 | /** |
| | 30 | * Adds a Value object to the mapOfValue. |
| | 31 | * @param aValue The value to add. |
| | 32 | */ |
| 25 | 33 | public void addValue (final Value aValue) { |
| 26 | 34 | this.aValueDefault = aValue; |
| … |
… |
|
| 29 | 37 | /** |
| 30 | 38 | * For velocity engine. |
| 31 | | * @return |
| | 39 | * @return The default value. |
| 32 | 40 | */ |
| 33 | 41 | public Value getDefaultValue () { |
| … |
… |
|
| 35 | 43 | } |
| 36 | 44 | |
| | 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 | */ |
| 37 | 50 | public Value getValue (final String sName) { |
| 38 | 51 | if (this.aValueDefault.getName().equals(sName)) { |
| … |
… |
|
| 52 | 65 | } |
| 53 | 66 | |
| | 67 | /** |
| | 68 | * Sets the default Value in the mapOfDefaultValue. |
| | 69 | * @param sDefaultValues The new default value. |
| | 70 | */ |
| 54 | 71 | public void setDefaultValues (final String sDefaultValues) { |
| 55 | 72 | this.aValueDefault.setName(sDefaultValues); |
| … |
… |
|
| 65 | 82 | } |
| 66 | 83 | |
| | 84 | /** |
| | 85 | * Defines or replaces the mapOfValue. |
| | 86 | * @param mapOfValue The new map of values. |
| | 87 | */ |
| 67 | 88 | public void setMapOfValue (final Map<String, Value> mapOfValue) throws ParameterException { |
| 68 | 89 | if (mapOfValue.size() != 1) { |
| … |
… |
|
| 72 | 93 | } |
| 73 | 94 | |
| | 95 | /** |
| | 96 | * Returns the type of the parameter. |
| | 97 | * @return The type TEXTAREA. |
| | 98 | */ |
| 74 | 99 | public ParameterType getType () { |
| 75 | 100 | return ParameterType.TEXTAREA; |
| 76 | 101 | } |
| 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 | */ |
| 78 | 108 | public boolean merge (final Parameter aParameter) { |
| 79 | 109 | TextAreaParameter.logger.trace("merge"); |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 19 | 19 | private Value aValueDefault; |
| 20 | 20 | |
| | 21 | /** |
| | 22 | * Default constructor for a TextFieldParameter |
| | 23 | * (see the Parameter default constructor). |
| | 24 | */ |
| 21 | 25 | protected TextFieldParameter () { |
| 22 | 26 | super(); |
| … |
… |
|
| 24 | 28 | } |
| 25 | 29 | |
| | 30 | /** |
| | 31 | * Adds a Value object to the mapOfValue. |
| | 32 | * @param aValue The value to add. |
| | 33 | */ |
| 26 | 34 | public void addValue (final Value aValue) { |
| 27 | 35 | this.aValueDefault = aValue; |
| 28 | 36 | } |
| 29 | 37 | |
| | 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 | */ |
| 30 | 43 | public Value getValue (final String sName) { |
| 31 | 44 | if (this.aValueDefault.getName().equals(sName)) { |
| … |
… |
|
| 45 | 58 | } |
| 46 | 59 | |
| | 60 | /** |
| | 61 | * Sets the default Value in the mapOfDefaultValue. |
| | 62 | * @param sDefaultValues The new default value. |
| | 63 | */ |
| 47 | 64 | public void setDefaultValues (final String sDefaultValues) { |
| 48 | 65 | this.aValueDefault.setName(sDefaultValues); |
| … |
… |
|
| 57 | 74 | return null; |
| 58 | 75 | } |
| 59 | | |
| | 76 | |
| | 77 | /** |
| | 78 | * Defines or replaces the mapOfValue. |
| | 79 | * @param mapOfValue The new map of values. |
| | 80 | */ |
| 60 | 81 | public void setMapOfValue (final Map<String, Value> mapOfValue) throws ParameterException { |
| 61 | 82 | if (mapOfValue.size() != 1) { |
| … |
… |
|
| 65 | 86 | this.aValueDefault = mapOfValue.values().iterator().next(); |
| 66 | 87 | } |
| 67 | | |
| | 88 | /** |
| | 89 | * Returns the type of the parameter. |
| | 90 | * @return The type TEXTFIELD. |
| | 91 | */ |
| 68 | 92 | public ParameterType getType () { |
| 69 | 93 | return ParameterType.TEXTFIELD; |
| 70 | 94 | } |
| 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 | */ |
| 72 | 101 | public boolean merge (final Parameter aParameter) { |
| 73 | 102 | TextFieldParameter.logger.trace("merge"); |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 92 | 92 | } |
| 93 | 93 | |
| | 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 | */ |
| 94 | 99 | public void addListOfMapping (final String sKey, final List<Mapping> listOfMapping) { |
| 95 | 100 | this.mapOfListOfMapping.put(sKey, listOfMapping); |
| 96 | 101 | } |
| 97 | 102 | |
| | 103 | /** |
| | 104 | * Checks if the given mapping exists. |
| | 105 | * @param sMapping |
| | 106 | * @return True if the map contains sMapping, else false. |
| | 107 | */ |
| 98 | 108 | public boolean hasMapping (final String sMapping) { |
| 99 | 109 | return null != this.mapOfListOfMapping.get(sMapping); |
| 100 | 110 | } |
| 101 | 111 | |
| | 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 | */ |
| 102 | 117 | public List<Mapping> getListOfMapping (final String sName) { |
| 103 | 118 | return this.mapOfListOfMapping.get(sName); |
-
|
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 $ |
| 2 | 2 | // Author: Damien LEROY. |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. |
| … |
… |
|
| 35 | 35 | |
| 36 | 36 | /** |
| | 37 | * Launches the Unicorn Framework. |
| 37 | 38 | * @param args |
| 38 | 39 | * @throws Exception |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 24 | 24 | private List<String> references; |
| 25 | 25 | |
| | 26 | /** |
| | 27 | * Default constructor for ExpandTest. |
| | 28 | * |
| | 29 | */ |
| 26 | 30 | public ExpandTest() { |
| 27 | 31 | references = new ArrayList<String>(); |
| 28 | 32 | } |
| 29 | 33 | |
| | 34 | /** |
| | 35 | * Removes the old references and updates the oldRefs list with the |
| | 36 | * current references before adding the new references. |
| | 37 | * |
| | 38 | */ |
| 30 | 39 | public void expand() { |
| 31 | 40 | enCours = true; |
| … |
… |
|
| 50 | 59 | } |
| 51 | 60 | |
| | 61 | /** |
| | 62 | * Tests the expand process. |
| | 63 | * @param args |
| | 64 | */ |
| 52 | 65 | public static void main(String[] args) { |
| 53 | 66 | ExpandTest test1 = new ExpandTest(); |
| 54 | | //test1.references.add("test2"); |
| 55 | | //test1.references.add("test5"); |
| 56 | 67 | test1.id = "css"; |
| 57 | 68 | testList.put("css", test1); |
| … |
… |
|
| 64 | 75 | ExpandTest test3 = new ExpandTest(); |
| 65 | 76 | test3.references.add("css"); |
| 66 | | //test3.references.add("test6"); |
| 67 | 77 | test3.id = "foo"; |
| 68 | 78 | 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"); |
| 84 | 79 | |
| 85 | 80 | for (ExpandTest test : testList.values()) { |
| 86 | | //System.out.println(test.id); |
| 87 | 81 | test.expand(); |
| 88 | 82 | } |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 51 | 51 | private static final Log logger = LogFactory.getLog("org.w3c.unicorn"); |
| 52 | 52 | |
| | 53 | private static final long serialVersionUID = -1375355420965607571L; |
| | 54 | |
| | 55 | private static final DiskFileItemFactory factory = new DiskFileItemFactory(); |
| | 56 | |
| 53 | 57 | /** |
| 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 | */ |
| 61 | 60 | private static final ServletFileUpload upload = new ServletFileUpload(FirstServlet.factory); |
| 62 | 61 | |
| … |
… |
|
| 321 | 320 | } |
| 322 | 321 | |
| | 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 | */ |
| 323 | 330 | private void addParameter ( |
| 324 | 331 | final String sParamName, |
| … |
… |
|
| 331 | 338 | } |
| 332 | 339 | |
| | 340 | /** |
| | 341 | * |
| | 342 | * @param sParamName |
| | 343 | * @param tStringParamValue |
| | 344 | * @param aUnicornCall |
| | 345 | * @param mapOfSpecificParameter |
| | 346 | * @param mapOfOutputParameter |
| | 347 | */ |
| 333 | 348 | private void addParameter ( |
| 334 | 349 | String sParamName, |
| … |
… |
|
| 473 | 488 | } |
| 474 | 489 | |
| 475 | | |
| 476 | | /* |
| | 490 | /** |
| 477 | 491 | * This method returns the first language of the accept language list |
| 478 | 492 | * which is equal to one of available index template language |
| | 493 | * |
| | 494 | * @param aLocale |
| | 495 | * @return The selected language or the default language. |
| 479 | 496 | */ |
| 480 | 497 | private String chooseTemplateLang(String aLocale){ |
| … |
… |
|
| 490 | 507 | } |
| 491 | 508 | |
| | 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 | */ |
| 492 | 516 | private String convertEnumerationToString(Enumeration myEnum){ |
| 493 | 517 | String ret = ""; |
-
|
r30
|
r89
|
|
| 14 | 14 | |
| 15 | 15 | 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 | | */ |
| 24 | 16 | |
| 25 | 17 | UnicornCall aUnicornCall = new UnicornCall(); |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 25 | 25 | Unmarshaller u = jc.createUnmarshaller(); |
| 26 | 26 | 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()); |
| 29 | 27 | Observationresponse obsres = (Observationresponse)u.unmarshal(url.openStream()); |
| 30 | 28 | System.out.println(obsres.isPassed()); |
-
|
r78
|
r89
|
|
| 21 | 21 | public class UnicornClient { |
| 22 | 22 | |
| | 23 | /** |
| | 24 | * Prints help contents on the standard output. |
| | 25 | * |
| | 26 | */ |
| 23 | 27 | public static void print_help() { |
| 24 | 28 | System.out.println("[Usage] UnicornClient task inputType=[mimetype=]pageToValid templateLanguage outputTemplate [otherParameters]"); |
| … |
… |
|
| 35 | 39 | } |
| 36 | 40 | |
| | 41 | /** |
| | 42 | * Tests Unicorn client. |
| | 43 | * @param args |
| | 44 | */ |
| 37 | 45 | public static void main(String[] args) { |
| 38 | 46 | 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 | | |
| 72 | 47 | |
| 73 | 48 | |
-
|
r43
|
r89
|
|
| 21 | 21 | public static void main(String[] args) { |
| 22 | 22 | |
| 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 | | */ |
| 30 | 23 | |
| 31 | 24 | UnicornCall aUnicornCall = new UnicornCall(); |
| … |
… |
|
| 42 | 35 | |
| 43 | 36 | 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")) |
| 49 | 37 | |
| 50 | 38 | try { |
-
|
r32
|
r89
|
|
| 40 | 40 | ClientHttpRequest.randomString(); |
| 41 | 41 | |
| | 42 | |
| | 43 | /** |
| | 44 | * Connects to the output stream of the URLConnection. |
| | 45 | * @throws IOException |
| | 46 | */ |
| 42 | 47 | private void connect () throws IOException { |
| 43 | 48 | //ClientHttpRequest.logger.trace("connect"); |
| … |
… |
|
| 47 | 52 | } |
| 48 | 53 | |
| | 54 | /** |
| | 55 | * Writes a single character on the output stream. |
| | 56 | * @param c The character to write. |
| | 57 | * @throws IOException |
| | 58 | */ |
| 49 | 59 | private void write (final char c) throws IOException { |
| 50 | 60 | this.connect(); |
| … |
… |
|
| 53 | 63 | } |
| 54 | 64 | |
| | 65 | /** |
| | 66 | * Writes a character string on the output stream. |
| | 67 | * @param s The string to write. |
| | 68 | * @throws IOException |
| | 69 | */ |
| 55 | 70 | protected void write (final String s) throws IOException { |
| 56 | 71 | this.connect(); |
| … |
… |
|
| 59 | 74 | } |
| 60 | 75 | |
| | 76 | /** |
| | 77 | * Writes a new line on the output stream (carriage return). |
| | 78 | * @throws IOException |
| | 79 | */ |
| 61 | 80 | protected void newline () throws IOException { |
| 62 | 81 | this.connect(); |
| … |
… |
|
| 64 | 83 | } |
| 65 | 84 | |
| | 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 | */ |
| 66 | 90 | protected void writeln (final String s) throws IOException { |
| 67 | 91 | this.connect(); |
| … |
… |
|
| 70 | 94 | } |
| 71 | 95 | |
| | 96 | /** |
| | 97 | * Computes a random string. |
| | 98 | * @return A string containing a random long which radix is 36. |
| | 99 | */ |
| 72 | 100 | protected static String randomString () { |
| 73 | 101 | return Long.toString(ClientHttpRequest.aRandom.nextLong(), 36); |
| 74 | 102 | } |
| 75 | 103 | |
| | 104 | /** |
| | 105 | * Writes the sBoundary on the output, composed of three random strings. |
| | 106 | * @throws IOException |
| | 107 | */ |
| 76 | 108 | private void boundary () throws IOException { |
| 77 | 109 | this.write("--"); |
| … |
… |
|
| 160 | 192 | } |
| 161 | 193 | |
| | 194 | /** |
| | 195 | * Sets a new language. |
| | 196 | * @param sLang The new language chosen. |
| | 197 | */ |
| 162 | 198 | public void setLang (final String sLang) { |
| 163 | 199 | ClientHttpRequest.logger.debug("setLang("+sLang+")"); |
| … |
… |
|
| 165 | 201 | } |
| 166 | 202 | |
| | 203 | /** |
| | 204 | * Writes a name in the appropriate format on the output. |
| | 205 | * @param sName The name to write. |
| | 206 | * @throws IOException |
| | 207 | */ |
| 167 | 208 | private void writeName (final String sName) throws IOException { |
| 168 | 209 | this.newline(); |
| … |
… |
|
| 193 | 234 | } |
| 194 | 235 | |
| | 236 | /** |
| | 237 | * |
| | 238 | * @param aInputStream |
| | 239 | * @param aOutputStream |
| | 240 | * @throws IOException |
| | 241 | */ |
| 195 | 242 | private static void pipe ( |
| 196 | 243 | final InputStream aInputStream, |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 18 | 18 | private static final LinkedHashMap<String, Locale> mapOfLocale = new LinkedHashMap<String, Locale>(); |
| 19 | 19 | |
| | 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 | */ |
| 20 | 25 | public static Locale getLocale (final String sLocale) { |
| 21 | 26 | return LocaleFactory.mapOfLocale.get(sLocale); |
| 22 | 27 | } |
| 23 | 28 | |
| | 29 | /** |
| | 30 | * Returns the values available in the mapOfLocale. |
| | 31 | * @return The collection of values. |
| | 32 | */ |
| 24 | 33 | public static Collection<Locale> values () { |
| 25 | 34 | return LocaleFactory.mapOfLocale.values(); |
-
|
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 $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 25 | 25 | private Map<String, String> mapOfString = null; |
| 26 | 26 | |
| | 27 | /** |
| | 28 | * Default constructor for LocalizedString. |
| | 29 | * |
| | 30 | */ |
| 27 | 31 | public LocalizedString () { |
| 28 | 32 | LocalizedString.logger.trace("Constructor"); |
| … |
… |
|
| 30 | 34 | } |
| 31 | 35 | |
| | 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 | */ |
| 32 | 41 | public LocalizedString (String s, String lang) { |
| 33 | 42 | this(); |
| … |
… |
|
| 35 | 44 | } |
| 36 | 45 | |
| | 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 | */ |
| 37 | 51 | public boolean hasLocale (final String sLocale) { |
| 38 | 52 | return null != this.mapOfString.get(sLocale); |
| 39 | 53 | } |
| 40 | 54 | |
| | 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 | */ |
| 41 | 63 | public String addLocalization ( |
| 42 | 64 | final String sLocale, |
| … |
… |
|
| 50 | 72 | } |
| 51 | 73 | |
| | 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 | */ |
| 52 | 81 | public String getLocalization (final String sLocale) { |
| 53 | 82 | final String sMessage = this.mapOfString.get(sLocale); |
| … |
… |
|
| 58 | 87 | } |
| 59 | 88 | |
| | 89 | /** |
| | 90 | * Returns the keys available in the mapOfString. |
| | 91 | * @return A set with all the keys. |
| | 92 | */ |
| 60 | 93 | public Set<String> getSetOfLocale () { |
| 61 | 94 | return this.mapOfString.keySet(); |
| 62 | 95 | } |
| 63 | 96 | |
| 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 | */ |
| 66 | 101 | public String toString () { |
| 67 | 102 | String res = this.mapOfString.get(LocalizedString.DEFAULT_LANGUAGE); |
-
|
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 $ |
| 2 | 2 | // Author: Damien LEROY. |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. |
| … |
… |
|
| 25 | 25 | private static final Map<String, Property> mapOfProperty = new Hashtable<String, Property>(); |
| 26 | 26 | |
| | 27 | /** |
| | 28 | * Adds a Property object to the static mapOfProperty. |
| | 29 | * @param aProperty The Property to be add. |
| | 30 | */ |
| 27 | 31 | private static void addProperty (final Property aProperty) { |
| 28 | 32 | Property.logger.trace("addProperty"); |
| … |
… |
|
| 34 | 38 | } |
| 35 | 39 | |
| | 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 | */ |
| 36 | 46 | public static Property getProperty (final String sID) { |
| 37 | 47 | return Property.mapOfProperty.get(sID); |
| 38 | 48 | } |
| 39 | 49 | |
| | 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 | */ |
| 40 | 56 | public static String get (final String sID) { |
| 41 | 57 | return Property.mapOfProperty.get(sID).getValue(); |
| 42 | 58 | } |
| 43 | 59 | |
| | 60 | /** |
| | 61 | * Adds the given properties in the map. |
| | 62 | * @param aProperties The properties to be loaded. |
| | 63 | */ |
| 44 | 64 | public static void load (final Properties aProperties) { |
| 45 | 65 | Property.logger.trace("load"); |
| … |
… |
|
| 53 | 73 | } |
| 54 | 74 | |
| | 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 | */ |
| 55 | 80 | private static void parseValue (final String sPropName, final String sPropValue) { |
| 56 | 81 | Property.logger.trace("parseValue"); |
| … |
… |
|
| 101 | 126 | private String sID = null; |
| 102 | 127 | |
| | 128 | /** |
| | 129 | * Gives the ID of the current Property. |
| | 130 | * @return The ID of the Property. |
| | 131 | */ |
| 103 | 132 | private String getID () { |
| 104 | 133 | return this.sID; |
| 105 | 134 | } |
| 106 | 135 | |
| | 136 | /** |
| | 137 | * Sets the ID of the Property. |
| | 138 | * @param sID The ID to set. |
| | 139 | */ |
| 107 | 140 | private void setID (final String sID) { |
| 108 | 141 | this.sID = sID; |
| 109 | 142 | } |
| 110 | 143 | |
| | 144 | /** |
| | 145 | * Adds a Property to the listOfElement. |
| | 146 | * @param aProperty The property to add. |
| | 147 | */ |
| 111 | 148 | private void addElement (final Property aProperty) { |
| 112 | 149 | this.listOfElement.add(aProperty); |
| 113 | 150 | } |
| 114 | 151 | |
| | 152 | /** |
| | 153 | * Erases the contents of listOfElement. |
| | 154 | * |
| | 155 | */ |
| 115 | 156 | public void clear () { |
| 116 | 157 | this.listOfElement.clear(); |
| … |
… |
|
| 118 | 159 | } |
| 119 | 160 | |
| | 161 | /** |
| | 162 | * Sets a specific element in the list. |
| | 163 | * @param sSpecific The name of the specific element. |
| | 164 | */ |
| 120 | 165 | public void setSpecific (final String sSpecific) { |
| 121 | 166 | this.sSpecificElement = sSpecific; |
| 122 | 167 | } |
| 123 | 168 | |
| | 169 | /** |
| | 170 | * Gives the value of the Property. |
| | 171 | * @return The value of the Property. |
| | 172 | */ |
| 124 | 173 | public String getValue () { |
| 125 | 174 | final int iStringBufferSize = 500; |
| … |
… |
|
| 162 | 211 | } |
| 163 | 212 | |
| | 213 | /** |
| | 214 | * For each Property in the map, prints its ID and value. |
| | 215 | * @param tArgument |
| | 216 | */ |
| 164 | 217 | public static void main (final String[] tArgument) { |
| 165 | 218 | System.out.println("Begin."); |
-
|
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 $ |
| 2 | 2 | // Author: Damien LEROY. |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. |
| … |
… |
|
| 19 | 19 | |
| 20 | 20 | public void addURL (final URL aURL) throws IOException, JAXBException, SAXException; |
| | 21 | |
| 21 | 22 | public void unmarshal () throws Exception; |
| 22 | 23 | |
-
|
r81
|
r89
|
|
| 1 | 1 | |
| 2 | | UNICORN_URL = http://localhost:8180/unicorn/ |
| 3 | | UNICORN_HOME = /var/lib/tomcat55/webapps/unicorn/ |
| | 2 | UNICORN_URL = http://localhost:8080/unicorn/ |
| | 3 | UNICORN_HOME = D:\barouh\Tomcat 6.0\webapps\unicorn |
| 4 | 4 | UNICORN_ENCODING = UTF-8 |
| 5 | 5 | |