private static String getKey(XmlFileModel key) { return key.getFilePath(); }
/** * Add the provided document to the cache. */ public static void cache(XmlFileModel key, Document document) { String cacheKey = getKey(key); map.put(cacheKey, new CacheDocument(false, document)); }
/** * Retrieve the currently cached value for the given document. */ public static Result get(XmlFileModel key) { String cacheKey = getKey(key); Result result = null; CacheDocument reference = map.get(cacheKey); if (reference == null) return new Result(false, null); if (reference.parseFailure) return new Result(true, null); Document document = reference.getDocument(); if (document == null) LOG.info("Cache miss on XML document: " + cacheKey); return new Result(false, document); }
private String processDoctypeVersion(DoctypeMetaModel entry) { String publicId = entry.getPublicId(); String systemId = entry.getSystemId(); // extract the version information from the public / system ID. String versionInformation = DoctypeUtils.extractVersion(publicId, systemId); return versionInformation; }
@Override public boolean isValid(GraphRewrite event,EvaluationContext context, XmlFileModel model) { if (( publicId != null && !publicId.isEmpty() ) || systemId!=null) { DoctypeMetaModel doctype = model.getDoctype(); if (doctype == null ) { return false; } if(publicId != null && ( (doctype.getPublicId() == null) || !doctype.getPublicId().matches(publicId))) { return false; } if(systemId != null && ( (doctype.getSystemId() == null) || !doctype.getSystemId().matches(systemId))) { return false; } } return true; }
@Override public void perform(GraphRewrite event, EvaluationContext context, DoctypeMetaModel payload) { String publicId = payload.getPublicId(); String systemId = payload.getSystemId(); // extract the version information from the public / system ID. String versionInformation = extractVersion(publicId, systemId); for (XmlFileModel xml : payload.getXmlResources()) { createHibernateConfigurationModel(event, context, xml, versionInformation); } }
private boolean isWebXml(XmlFileModel xml, Document doc) { // check it's doctype against the known doctype. return !(xml.getDoctype() != null && !processDoctypeMatches(xml.getDoctype())); }
/** * Perform this function for each {@link WindupVertexFrame} returned by the "when" clause. */ public void perform(GraphRewrite event, EvaluationContext context, PAYLOADTYPE payload) { Document doc = payload.asDocument(); if(doc == null) { LOG.warning("Document is null."); return; } perform(event, context, payload, doc); }
private boolean isExceptionRelatedToSource(XmlFileModel sourceFile, SAXParseException e) { if (e.getSystemId() == null) return true; // Just assume that it is related, in the absence of other information if (e.getSystemId().startsWith("http://") || e.getSystemId().startsWith("https://") || e.getSystemId().startsWith("ftp://")) return false; return e.getSystemId().endsWith(sourceFile.getFileName()); }
private String processDoctypeVersion(DoctypeMetaModel entry) { String publicId = entry.getPublicId(); String systemId = entry.getSystemId(); // extract the version information from the public / system ID. String versionInformation = DoctypeUtils.extractVersion(publicId, systemId); return versionInformation; }
@Override public void perform(GraphRewrite event, EvaluationContext context, DoctypeMetaModel payload) { String publicId = payload.getPublicId(); String systemId = payload.getSystemId(); // extract the version information from the public / system ID. String versionInformation = extractVersion(publicId, systemId); for (XmlFileModel xml : payload.getXmlResources()) { createHibernateConfigurationModel(event, context, xml, versionInformation); } }
@Override public boolean isValid(GraphRewrite event,EvaluationContext context, XmlFileModel model) { if (xmlCache.contains(model.getFilePath())) { return false; } else { xmlCache.add(model.getFilePath()); } return true; }
private boolean isWebXml(XmlFileModel xml, Document doc) { // check it's doctype against the known doctype. if (xml.getDoctype() != null && !processDoctypeMatches(xml.getDoctype())) { return false; } return true; }
private boolean isExceptionRelatedToSource(XmlFileModel sourceFile, SAXParseException e) { if (e.getSystemId() == null) return true; // Just assume that it is related, in the absence of other information if (e.getSystemId().startsWith("http://") || e.getSystemId().startsWith("https://") || e.getSystemId().startsWith("ftp://")) return false; return e.getSystemId().endsWith(sourceFile.getFileName()); }
/** * Cache a parse failure for this document. */ public static void cacheParseFailure(XmlFileModel key) { map.put(getKey(key), new CacheDocument(true, null)); }
private String processDoctypeVersion(DoctypeMetaModel entry) { String publicId = entry.getPublicId(); String systemId = entry.getSystemId(); // extract the version information from the public / system ID. String versionInformation = DoctypeUtils.extractVersion(publicId, systemId); return versionInformation; }
private boolean isWebXml(XmlFileModel xml, Document doc) { // check it's doctype against the known doctype. return !(xml.getDoctype() != null && !processDoctypeMatches(xml.getDoctype())); }
private String processDoctypeVersion(DoctypeMetaModel entry) { String publicId = entry.getPublicId(); String systemId = entry.getSystemId(); // extract the version information from the public / system ID. String versionInformation = DoctypeUtils.extractVersion(publicId, systemId); return versionInformation; }
private String processDoctypeVersion(DoctypeMetaModel entry) { String publicId = entry.getPublicId(); String systemId = entry.getSystemId(); // extract the version information from the public / system ID. String versionInformation = DoctypeUtils.extractVersion(publicId, systemId); return versionInformation; }
private String processDoctypeVersion(DoctypeMetaModel entry) { String publicId = entry.getPublicId(); String systemId = entry.getSystemId(); // extract the version information from the public / system ID. String versionInformation = DoctypeUtils.extractVersion(publicId, systemId); return versionInformation; }