int idx = path.lastIndexOf('/');
String colName = path.substring(0, idx);
String docName = path.substring(idx + 1);
try {
CollectionClientImpl col = (CollectionClientImpl)client.getCollection(colName);
if ( col == null )
throw new CompilationException("Template Collection '" + colName + "' not found");
RecordMetaData meta = col.getInternalCollection().getRecordMetaData(tx, new Key(docName));
long lastModified = System.currentTimeMillis();
if ( meta != null ) {
Long lm = (Long)meta.getValue(RecordMetaData.MODIFIED);
if ( lm != null )
lastModified = lm.longValue();
}
TemplatesInfo info = (TemplatesInfo)cache.get(path);
if ( info == null || info.lastModified != lastModified ) {
Document doc = col.getDocument(docName);
String systemID = URL_PREFIX+colName+"/"+docName;
Source src = new DOMSource(doc, systemID);
Templates t = tf.newTemplates(src);
info = new TemplatesInfo(path, lastModified, t);