/** Calculate the operation, given action and data access point */ public static String mapRequestToOperation(HttpAction action, DataAccessPoint dsRef) { if ( dsRef == null ) return "" ; String uri = action.getActionURI() ; String name = dsRef.getName(); if ( name.length() >= uri.length() ) return "" ; return uri.substring(name.length()+1) ; // Skip the separating "/" }
/** Calculate the operation, given action and data access point */ public static String mapRequestToOperation(HttpAction action, DataAccessPoint dsRef) { if ( dsRef == null ) return "" ; String uri = action.getActionURI() ; String name = dsRef.getName(); if ( name.length() >= uri.length() ) return "" ; return uri.substring(name.length()+1) ; // Skip the separating "/" }
public void register(DataAccessPoint accessPt) { register(accessPt.getName(), accessPt); }
public void register(DataAccessPoint accessPt) { register(accessPt.getName(), accessPt); }
private static void enable(DataAccessPointRegistry registry, List<DataAccessPoint> datapoints) { for ( DataAccessPoint dap : datapoints ) { Fuseki.configLog.info("Register: "+dap.getName()) ; dap.getDataService().goActive(); registry.register(dap); } }
private static void enable(DataAccessPointRegistry registry, List<DataAccessPoint> datapoints) { for ( DataAccessPoint dap : datapoints ) { Fuseki.configLog.info("Register: "+dap.getName()) ; dap.getDataService().goActive(); registry.register(dap); } }
public void print(String string) { System.out.flush() ; if ( string == null ) string = "DataAccessPointRegistry" ; System.out.println("== "+string) ; this.forEach((k,ref)->{ System.out.printf(" (key=%s, ref=%s)\n", k, ref.getName()) ; ref.getDataService().getOperations().forEach((op)->{ ref.getDataService().getEndpoints(op).forEach(ep->{ System.out.printf(" %s : %s\n", op, ep.getName()) ; }); }); }) ; }
public void print(String string) { System.out.flush() ; if ( string == null ) string = "DataAccessPointRegistry" ; System.out.println("== "+string) ; this.forEach((k,ref)->{ System.out.printf(" (key=%s, ref=%s)\n", k, ref.getName()) ; ref.getDataService().getOperations().forEach((op)->{ ref.getDataService().getEndpoints(op).forEach(ep->{ System.out.printf(" %s : %s\n", op, ep.getName()) ; }); }); }) ; }
private void statsTxt(ServletOutputStream out, DataAccessPoint desc) throws IOException out.println("Dataset: "+desc.getName()) ; out.println(" Requests = "+dSrv.getCounters().value(CounterName.Requests)) ; out.println(" Good = "+dSrv.getCounters().value(CounterName.RequestsGood)) ;
private void statsTxt(ServletOutputStream out, DataAccessPoint desc) throws IOException out.println("Dataset: "+desc.getName()) ; out.println(" Requests = "+dSrv.getCounters().value(CounterName.Requests)) ; out.println(" Good = "+dSrv.getCounters().value(CounterName.RequestsGood)) ;
/** Initialization after action creation during lifecycle setup. * <p>Sets the action dataset. Setting will replace any existing {@link DataAccessPoint} and {@link DataService}, * as the {@link DatasetGraph} of the current HTTP Action.</p> * * <p>Once it has updated its members, the HTTP Action will change its transactional state and * {@link Transactional} instance according to its base dataset graph.</p> * * @param dataAccessPoint {@link DataAccessPoint} * @param dService {@link DataService} * @see Transactional */ public void setRequest(DataAccessPoint dataAccessPoint, DataService dService) { this.dataAccessPoint = dataAccessPoint ; if ( dataAccessPoint != null ) this.datasetName = dataAccessPoint.getName() ; if ( this.dataService != null ) throw new FusekiException("Redefinition of DatasetRef in the request action") ; this.dataService = dService ; if ( dService == null || dService.getDataset() == null ) // Null does not happens for service requests, (it does for admin requests - call setControlRequest) throw new FusekiException("Null DataService in the request action") ; setDataset(dService.getDataset()) ; }
/** Initialization after action creation during lifecycle setup. * <p>Sets the action dataset. Setting will replace any existing {@link DataAccessPoint} and {@link DataService}, * as the {@link DatasetGraph} of the current HTTP Action.</p> * * <p>Once it has updated its members, the HTTP Action will change its transactional state and * {@link Transactional} instance according to its base dataset graph.</p> * * @param dataAccessPoint {@link DataAccessPoint} * @param dService {@link DataService} * @see Transactional */ public void setRequest(DataAccessPoint dataAccessPoint, DataService dService) { this.dataAccessPoint = dataAccessPoint ; if ( dataAccessPoint != null ) this.datasetName = dataAccessPoint.getName() ; if ( this.dataService != null ) throw new FusekiException("Redefinition of DatasetRef in the request action") ; this.dataService = dService ; if ( dService == null || dService.getDataset() == null ) // Null does not happens for service requests, (it does for admin requests - call setControlRequest) throw new FusekiException("Null DataService in the request action") ; setDataset(dService.getDataset()) ; }
"Not found: dataset='" + printName(action.getDataAccessPoint().getName()) + "' endpoint='" + printName(endpointName) + "'");
"Not found: dataset='" + printName(action.getDataAccessPoint().getName()) + "' endpoint='" + printName(endpointName) + "'");
public static void describe(JsonBuilder builder, DataAccessPoint access) { builder.startObject() ; builder.key(ServerConst.dsName).value(access.getName()) ; builder.key(ServerConst.dsState).value(access.getDataService().isAcceptingRequests()) ; builder.key(ServerConst.dsService) ; builder.startArray() ; for ( Operation operation : access.getDataService().getOperations() ) { List<Endpoint> endpoints = access.getDataService().getEndpoints(operation) ; describe(builder, operation, endpoints) ; } builder.finishArray() ; builder.finishObject() ; }
public static void describe(JsonBuilder builder, DataAccessPoint access) { builder.startObject() ; builder.key(ServerConst.dsName).value(access.getName()) ; builder.key(ServerConst.dsState).value(access.getDataService().isAcceptingRequests()) ; builder.key(ServerConst.dsService) ; builder.startArray() ; for ( Operation operation : access.getDataService().getOperations() ) { List<Endpoint> endpoints = access.getDataService().getEndpoints(operation) ; describe(builder, operation, endpoints) ; } builder.finishArray() ; builder.finishObject() ; }
private static void statsDataset(JsonBuilder builder, DataAccessPoint access) { // Object started builder.key(access.getName()) ; DataService dSrv = access.getDataService() ; builder.startObject("counters") ; builder.key(CounterName.Requests.getName()).value(dSrv.getCounters().value(CounterName.Requests)) ; builder.key(CounterName.RequestsGood.getName()).value(dSrv.getCounters().value(CounterName.RequestsGood)) ; builder.key(CounterName.RequestsBad.getName()).value(dSrv.getCounters().value(CounterName.RequestsBad)) ; builder.key(ServerConst.endpoints).startObject("endpoints") ; for ( Operation operName : dSrv.getOperations() ) { List<Endpoint> endpoints = access.getDataService().getEndpoints(operName) ; for ( Endpoint endpoint : endpoints ) { // Endpoint names are unique for a given service. builder.key(endpoint.getName()) ; builder.startObject() ; operationCounters(builder, endpoint); builder.key(ServerConst.operation).value(operName.getName()) ; builder.key(ServerConst.description).value(operName.getDescription()); builder.finishObject() ; } } builder.finishObject("endpoints") ; builder.finishObject("counters") ; }
private static void statsDataset(JsonBuilder builder, DataAccessPoint access) { // Object started builder.key(access.getName()) ; DataService dSrv = access.getDataService() ; builder.startObject("counters") ; builder.key(CounterName.Requests.getName()).value(dSrv.getCounters().value(CounterName.Requests)) ; builder.key(CounterName.RequestsGood.getName()).value(dSrv.getCounters().value(CounterName.RequestsGood)) ; builder.key(CounterName.RequestsBad.getName()).value(dSrv.getCounters().value(CounterName.RequestsBad)) ; builder.key(ServerConst.endpoints).startObject("endpoints") ; for ( Operation operName : dSrv.getOperations() ) { List<Endpoint> endpoints = access.getDataService().getEndpoints(operName) ; for ( Endpoint endpoint : endpoints ) { // Endpoint names are unique for a given service. builder.key(endpoint.getName()) ; builder.startObject() ; operationCounters(builder, endpoint); builder.key(ServerConst.operation).value(operName.getName()) ; builder.key(ServerConst.description).value(operName.getDescription()); builder.finishObject() ; } } builder.finishObject("endpoints") ; builder.finishObject("counters") ; }