Changeset 5229
- Timestamp:
- 05/19/14 11:46:01 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/trunk/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIComponentProfileNamePostProcessor.java
r4507 r5229 2 2 3 3 import com.ximpleware.AutoPilot; 4 import com.ximpleware.NavException; 4 5 import com.ximpleware.VTDGen; 5 6 import com.ximpleware.VTDNav; 7 import com.ximpleware.XPathEvalException; 6 8 import com.ximpleware.XPathParseException; 7 import eu.clarin.cmdi.vlo.config.VloConfig;8 9 import java.util.HashMap; 9 10 import org.slf4j.Logger; … … 13 14 * Takes the value of the componentprofileid and uses the componentregistry REST service to transform this to the name of the componentprofile. 14 15 */ 15 public class CMDIComponentProfileNamePostProcessor implements PostProcessor{ 16 17 private static String XPATH = "/CMD_ComponentSpec/Header/Name/text()"; 16 public class CMDIComponentProfileNamePostProcessor implements PostProcessor { 17 private static final String XPATH = "/CMD_ComponentSpec/Header/Name/text()"; 18 18 private String BASE_URL = null; 19 AutoPilot ap = null;20 VTDGen vg = null;21 VTDNav vn = null;19 private AutoPilot ap = null; 20 private VTDGen vg = null; 21 private VTDNav vn = null; 22 22 23 23 private static final String _EMPTY_STRING = ""; … … 32 32 result = cache.get(profileId); 33 33 } 34 else {34 else { 35 35 setup(); 36 36 // get the name of the profile from the expanded xml in the component registry 37 37 if(vg.parseHttpUrl(BASE_URL + profileId + "/xml", true)){ 38 LOG. info("PARSED: "+BASE_URL+profileId);38 LOG.debug("PARSED: "+BASE_URL+profileId); 39 39 vn = vg.getNav(); 40 40 ap.bind(vn); … … 42 42 try { 43 43 idx = ap.evalXPath(); 44 LOG. info("EVALUATED XPATH: "+XPATH+ " found idx: "+idx);44 LOG.debug("EVALUATED XPATH: "+XPATH+ " found idx: "+idx); 45 45 if(idx == -1){ // idx represent the nodeId in the xml file, if -1 the xpath evaluates to nothing. 46 46 return result; … … 48 48 result = vn.toString(idx); 49 49 cache.put(profileId, result); 50 } catch (Exception e) { 50 } catch (NavException e) { 51 LOG.error(e.getLocalizedMessage()); 52 return result; 53 } catch (XPathEvalException e) { 51 54 LOG.error(e.getLocalizedMessage()); 52 55 return result; 53 56 } 54 57 } 55 else {56 LOG.error("C ANNOT OPEN AND/OR PARSE: " +BASE_URL + profileId);58 else { 59 LOG.error("Cannot open and/or parse XML Schema: {}.", BASE_URL + profileId); 57 60 } 58 61 }
Note: See TracChangeset
for help on using the changeset viewer.