()
| 360 | } |
| 361 | |
| 362 | protected void parseCreole() { |
| 363 | |
| 364 | valid = true; |
| 365 | |
| 366 | resourceInfoList = new ArrayList<ResourceInfo>(); |
| 367 | requiredPlugins = new LinkedHashSet<Plugin>(); |
| 368 | |
| 369 | String relativePathMarker = "$relpath$"; |
| 370 | String gatehomePathMarker = "$gatehome$"; |
| 371 | String gatepluginsPathMarker = "$gateplugins$"; |
| 372 | |
| 373 | try { |
| 374 | org.jdom.Document creoleDoc = getMetadataXML(); |
| 375 | |
| 376 | minGateVersion = creoleDoc.getRootElement().getAttributeValue("GATE-MIN",""); |
| 377 | version = creoleDoc.getRootElement().getAttributeValue("VERSION",""); |
| 378 | description = creoleDoc.getRootElement().getAttributeValue("DESCRIPTION"); |
| 379 | name = creoleDoc.getRootElement().getAttributeValue("NAME"); |
| 380 | |
| 381 | final Map<String, ResourceInfo> resInfos = |
| 382 | new LinkedHashMap<String, ResourceInfo>(); |
| 383 | List<Element> jobsList = new ArrayList<Element>(); |
| 384 | List<String> jarsToScan = new ArrayList<String>(); |
| 385 | List<String> allJars = new ArrayList<String>(); |
| 386 | jobsList.add(creoleDoc.getRootElement()); |
| 387 | while(!jobsList.isEmpty()) { |
| 388 | Element currentElem = jobsList.remove(0); |
| 389 | if(currentElem.getName().equalsIgnoreCase("JAR")) { |
| 390 | @SuppressWarnings("unchecked") |
| 391 | List<Attribute> attrs = currentElem.getAttributes(); |
| 392 | Iterator<Attribute> attrsIt = attrs.iterator(); |
| 393 | while(attrsIt.hasNext()) { |
| 394 | Attribute attr = attrsIt.next(); |
| 395 | if(attr.getName().equalsIgnoreCase("SCAN") |
| 396 | && attr.getBooleanValue()) { |
| 397 | jarsToScan.add(currentElem.getTextTrim()); |
| 398 | break; |
| 399 | } |
| 400 | } |
| 401 | allJars.add(currentElem.getTextTrim()); |
| 402 | } else if(currentElem.getName().equalsIgnoreCase("RESOURCE")) { |
| 403 | // we don't go deeper than resources so no recursion here |
| 404 | String resName = currentElem.getChildTextTrim("NAME"); |
| 405 | String resClass = currentElem.getChildTextTrim("CLASS"); |
| 406 | String resComment = currentElem.getChildTextTrim("COMMENT"); |
| 407 | String resHelpURL = currentElem.getChildText("HELPURL"); |
| 408 | if(!resInfos.containsKey(resClass)) { |
| 409 | // create the handler |
| 410 | ResourceInfo rHandler = |
| 411 | new ResourceInfo(resName, resClass, resComment, resHelpURL); |
| 412 | resInfos.put(resClass, rHandler); |
| 413 | } |
| 414 | } else if(currentElem.getName().equalsIgnoreCase("REQUIRES")) { |
| 415 | |
| 416 | if(currentElem.getAttribute("GROUP") != null) { |
| 417 | // TODO probably need more error checking here |
| 418 | requiredPlugins |
| 419 | .add(new Plugin.Maven(currentElem.getAttributeValue("GROUP"), |
no test coverage detected