/** * Overrides superclass for better performance. * @since 1.6 */ public boolean resourceExists(final String name) { if (name == null) { return false; } return (this.repository.getStringResource(name) != null); }
/** * Overrides superclass for better performance. * @since 1.6 */ public boolean resourceExists(final String name) { if (name == null) { return false; } return (this.repository.getStringResource(name) != null); }
/** * Overrides superclass for better performance. * @since 1.6 */ public boolean resourceExists(final String name) { if (name == null) { return false; } return (this.repository.getStringResource(name) != null); }
/** * @see ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource) */ public long getLastModified(final Resource resource) { StringResource original = null; original = this.repository.getStringResource(resource.getName()); return (original != null) ? original.getLastModified() : 0; }
/** * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource) */ public long getLastModified(final Resource resource) { StringResource original = null; original = this.repository.getStringResource(resource.getName()); return (original != null) ? original.getLastModified() : 0; }
/** * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource) */ public long getLastModified(final Resource resource) { StringResource original = null; original = this.repository.getStringResource(resource.getName()); return (original != null) ? original.getLastModified() : 0; }
/** {@inheritDoc} */ public long getLastModified(final Resource resource) { StringResource original = null; original = this.repository.getStringResource(resource.getName()); return (original != null) ? original.getLastModified() : 0; }
protected boolean isCached() { return getRepository().getStringResource(getId()) != null; }
/** {@inheritDoc} */ public boolean isSourceModified(final Resource resource) { StringResource original = null; boolean result = true; original = this.repository.getStringResource(resource.getName()); if (original != null) { result = original.getLastModified() != resource.getLastModified(); } return result; }
/** * @see ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource) */ public boolean isSourceModified(final Resource resource) { StringResource original = null; boolean result = true; original = this.repository.getStringResource(resource.getName()); if (original != null) { result = original.getLastModified() != resource.getLastModified(); } return result; }
/** * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource) */ public boolean isSourceModified(final Resource resource) { StringResource original = null; boolean result = true; original = this.repository.getStringResource(resource.getName()); if (original != null) { result = original.getLastModified() != resource.getLastModified(); } return result; }
/** * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource) */ public boolean isSourceModified(final Resource resource) { StringResource original = null; boolean result = true; original = this.repository.getStringResource(resource.getName()); if (original != null) { result = original.getLastModified() != resource.getLastModified(); } return result; }
/** * Get an InputStream so that the Runtime can build a template with it. * * @param name name of template to get. * @return InputStream containing the template. * @throws ResourceNotFoundException Ff template not found in the RepositoryFactory. */ public InputStream getResourceStream(final String name) throws ResourceNotFoundException { if (StringUtils.isEmpty(name)) { throw new ResourceNotFoundException("No template name provided"); } StringResource resource = this.repository.getStringResource(name); if (resource == null) { throw new ResourceNotFoundException("Could not locate resource '" + name + "'"); } byte[] byteArray = null; try { byteArray = resource.getBody().getBytes(resource.getEncoding()); return new ByteArrayInputStream(byteArray); } catch (UnsupportedEncodingException ue) { throw new VelocityException("Could not convert String using encoding " + resource.getEncoding(), ue); } }
StringResource resource = this.repository.getStringResource(name);
StringResource resource = this.repository.getStringResource(name);
StringResource resource = this.repository.getStringResource(name);
repo.putStringResource("alert_template", templateString); Assert.assertEquals(templateString, repo.getStringResource("alert_template").getBody());