public static Resource getResource(URL url) throws IOException { return new VfsResource(VfsUtils.getRoot(url)); }
public static Resource getResource(URI uri) throws IOException { return new VfsResource(VfsUtils.getRoot(uri)); } }
@Override public Resource createRelative(String relativePath) throws IOException { if (!relativePath.startsWith(".") && relativePath.contains("/")) { try { return new VfsResource(VfsUtils.getChild(this.resource, relativePath)); } catch (IOException ex) { // fall back to getRelative } } return new VfsResource(VfsUtils.getRelative(new URL(getURL(), relativePath))); }
public void visit(Object vfsResource) { if (this.pathMatcher.match(this.subPattern, VfsPatternUtils.getPath(vfsResource).substring(this.rootPath.length()))) { this.resources.add(new VfsResource(vfsResource)); } }
public static Resource getResource(URI uri) throws IOException { return new VfsResource(VfsUtils.getRoot(uri)); } }
public static Resource getResource(URL url) throws IOException { return new VfsResource(VfsUtils.getRoot(url)); }
@Override public Resource createRelative(String relativePath) throws IOException { if (!relativePath.startsWith(".") && relativePath.contains("/")) { try { return new VfsResource(VfsUtils.getChild(this.resource, relativePath)); } catch (IOException ex) { // fall back to getRelative } } return new VfsResource(VfsUtils.getRelative(new URL(getURL(), relativePath))); }
public void visit(Object vfsResource) { if (this.pathMatcher.match(this.subPattern, VfsPatternUtils.getPath(vfsResource).substring(this.rootPath.length()))) { this.resources.add(new VfsResource(vfsResource)); } }
public static Resource getResource(URI uri) throws IOException { return new VfsResource(VfsUtils.getRoot(uri)); } }
public static Resource getResource(URL url) throws IOException { return new VfsResource(VfsUtils.getRoot(url)); }
@Override public Resource createRelative(String relativePath) throws IOException { if (!relativePath.startsWith(".") && relativePath.contains("/")) { try { return new VfsResource(VfsUtils.getChild(this.resource, relativePath)); } catch (IOException ex) { // fall back to getRelative } } return new VfsResource(VfsUtils.getRelative(new URL(getURL(), relativePath))); }
public void visit(Object vfsResource) { if (this.pathMatcher.match(this.subPattern, VfsPatternUtils.getPath(vfsResource).substring(this.rootPath.length()))) { this.resources.add(new VfsResource(vfsResource)); } }
public static Resource getResource(URI uri) throws IOException { return new VfsResource(VfsUtils.getRoot(uri)); } }
public static Resource getResource(URL url) throws IOException { return new VfsResource(VfsUtils.getRoot(url)); }
@Override public Resource createRelative(String relativePath) throws IOException { if (!relativePath.startsWith(".") && relativePath.contains("/")) { try { return new VfsResource(VfsUtils.getChild(this.resource, relativePath)); } catch (IOException ex) { // fall back to getRelative } } return new VfsResource(VfsUtils.getRelative(new URL(getURL(), relativePath))); }
@Override public Resource createRelative(String relativePath) throws IOException { if (!relativePath.startsWith(".") && relativePath.contains("/")) { try { return new VfsResource(VfsUtils.getChild(this.resource, relativePath)); } catch (IOException ex) { // fall back to getRelative } } return new VfsResource(VfsUtils.getRelative(new URL(getURL(), relativePath))); }
public void visit(Object vfsResource) { if (this.pathMatcher.match(this.subPattern, VfsPatternUtils.getPath(vfsResource).substring(this.rootPath.length()))) { this.resources.add(new VfsResource(vfsResource)); } }
public void visit(Object vfsResource) { if (this.pathMatcher.match(this.subPattern, VfsPatternUtils.getPath(vfsResource).substring(this.rootPath.length()))) { this.resources.add(new VfsResource(vfsResource)); } }
/** * Gets last modified date/time for the module. * @return the date/time */ public static DateTime getDateTime() { try { final Class clazz = CasVersion.class; final URL resource = clazz.getResource(clazz.getSimpleName() + ".class"); if ("file".equals(resource.getProtocol())) { return new DateTime(new File(resource.toURI()).lastModified()); } if ("jar".equals(resource.getProtocol())) { final String path = resource.getPath(); final File file = new File(path.substring(5, path.indexOf('!'))); return new DateTime(file.lastModified()); } if ("vfs".equals(resource.getProtocol())) { final File file = new VfsResource(resource.openConnection().getContent()).getFile(); return new DateTime(file.lastModified()); } LOGGER.warn("Unhandled url protocol: {} resource: {}", resource.getProtocol(), resource); return DateTime.now(); } catch (final Exception e) { throw Throwables.propagate(e); } } }
/** * Gets last modified date/time for the module. * * @return the date/time */ @SneakyThrows public static ZonedDateTime getDateTime() { val clazz = CasVersion.class; val resource = clazz.getResource(clazz.getSimpleName() + ".class"); if ("file".equals(resource.getProtocol())) { return DateTimeUtils.zonedDateTimeOf(new File(resource.toURI()).lastModified()); } if ("jar".equals(resource.getProtocol())) { val path = resource.getPath(); val file = new File(path.substring(JAR_PROTOCOL_STARTING_INDEX, path.indexOf('!'))); return DateTimeUtils.zonedDateTimeOf(file.lastModified()); } if ("vfs".equals(resource.getProtocol())) { val file = new VfsResource(resource.openConnection().getContent()).getFile(); return DateTimeUtils.zonedDateTimeOf(file.lastModified()); } LOGGER.warn("Unhandled url protocol: [{}] resource: [{}]", resource.getProtocol(), resource); return ZonedDateTime.now(); } }