/** Implementation of mapRequestToDataset(String) that looks for * the longest match in the registry. * This includes use in direct naming GSP. */ public static String mapRequestToDatasetLongest$(String uri, DataAccessPointRegistry registry) { if ( uri == null ) return null ; // This covers local, using the URI as a direct name for // a graph, not just using the indirect ?graph= or ?default // forms. String ds = null ; for ( String ds2 : registry.keys() ) { if ( ! uri.startsWith(ds2) ) continue ; if ( ds == null ) { ds = ds2 ; continue ; } if ( ds.length() < ds2.length() ) { ds = ds2 ; continue ; } } return ds ; }
/** Implementation of mapRequestToDataset(String) that looks for * the longest match in the registry. * This includes use in direct naming GSP. */ public static String mapRequestToDatasetLongest$(String uri, DataAccessPointRegistry registry) { if ( uri == null ) return null ; // This covers local, using the URI as a direct name for // a graph, not just using the indirect ?graph= or ?default // forms. String ds = null ; for ( String ds2 : registry.keys() ) { if ( ! uri.startsWith(ds2) ) continue ; if ( ds == null ) { ds = ds2 ; continue ; } if ( ds.length() < ds2.length() ) { ds = ds2 ; continue ; } } return ds ; }
private void statsTxt(HttpServletResponse resp, DataAccessPointRegistry registry) throws IOException { ServletOutputStream out = resp.getOutputStream() ; resp.setContentType(contentTypeTextPlain); resp.setCharacterEncoding(charsetUTF8) ; Iterator<String> iter = registry.keys().iterator() ; while(iter.hasNext()) { String ds = iter.next() ; DataAccessPoint desc = registry.get(ds) ; statsTxt(out, desc) ; if ( iter.hasNext() ) out.println() ; } out.flush() ; }
private void statsTxt(HttpServletResponse resp, DataAccessPointRegistry registry) throws IOException { ServletOutputStream out = resp.getOutputStream() ; resp.setContentType(contentTypeTextPlain); resp.setCharacterEncoding(charsetUTF8) ; Iterator<String> iter = registry.keys().iterator() ; while(iter.hasNext()) { String ds = iter.next() ; DataAccessPoint desc = registry.get(ds) ; statsTxt(out, desc) ; if ( iter.hasNext() ) out.println() ; } out.flush() ; }
/** * Return a collection of the names registered. This collection does not change as the * server changes. */ public static Collection<String> names(FusekiServer server) { DataAccessPointRegistry dataAccessPoints = DataAccessPointRegistry.get(server.getServletContext()); int N = dataAccessPoints.size(); Stream<String> stream = DataAccessPointRegistry.get(server.getServletContext()).keys().stream(); // Correct size, no reallocate. List<String> names = stream.collect(Collectors.toCollection(() -> new ArrayList<>(N))); return names; }
/** * Return a collection of the names registered. This collection does not change as the * server changes. */ public static Collection<String> names(FusekiServer server) { DataAccessPointRegistry dataAccessPoints = DataAccessPointRegistry.get(server.getServletContext()); int N = dataAccessPoints.size(); Stream<String> stream = DataAccessPointRegistry.get(server.getServletContext()).keys().stream(); // Correct size, no reallocate. List<String> names = stream.collect(Collectors.toCollection(() -> new ArrayList<>(N))); return names; }
dataAccessPoints.keys().stream() .map(name-> dataAccessPoints.get(name).getDataService().getDataset()) .anyMatch(DataAccessCtl::isAccessControlled); hasAuthenticationUse = dataAccessPoints.keys().stream() .map(name-> dataAccessPoints.get(name).getDataService()) .anyMatch(dSvc->dSvc.authPolicy() != null); hasAuthenticationUse = dataAccessPoints.keys().stream() .map(name-> dataAccessPoints.get(name).getDataService()) .flatMap(dSrv->dSrv.getEndpoints().stream())
dataAccessPoints.keys().stream() .map(name-> dataAccessPoints.get(name).getDataService().getDataset()) .anyMatch(DataAccessCtl::isAccessControlled); hasAuthenticationUse = dataAccessPoints.keys().stream() .map(name-> dataAccessPoints.get(name).getDataService()) .anyMatch(dSvc->dSvc.authPolicy() != null); hasAuthenticationUse = dataAccessPoints.keys().stream() .map(name-> dataAccessPoints.get(name).getDataService()) .flatMap(dSrv->dSrv.getEndpoints().stream())
public static void arrayDatasets(JsonBuilder builder, DataAccessPointRegistry registry) { builder.startArray() ; for ( String ds : registry.keys() ) { DataAccessPoint access = registry.get(ds) ; JsonDescription.describe(builder, access) ; } builder.finishArray() ; }
public static void arrayDatasets(JsonBuilder builder, DataAccessPointRegistry registry) { builder.startArray() ; for ( String ds : registry.keys() ) { DataAccessPoint access = registry.get(ds) ; JsonDescription.describe(builder, access) ; } builder.finishArray() ; }