public boolean manages(String uri) { if ( registry.containsKey(uri) ) return true ; if ( MappedLoader.isPossibleDynamicURI(uri, PropertyFunction.class) ) return true ; return false ; }
public static boolean isPossibleDynamicURI(String uri, Class<?> expectedClass) { String mappedUri = mapDynamicURI(uri); if (mappedUri == null) return false; // Need to force the load to check everything. // Callers (who are expectedClass sensitive) should have // an "alreadyLoaded" cache return loadClass(uri, expectedClass) != null; }
/** Lookup by URI */ public ProcedureFactory get(String uri) { ProcedureFactory procedure = registry.get(uri) ; if ( procedure != null ) return procedure ; if ( attemptedLoads.contains(uri) ) return null ; Class<?> procedureClass = MappedLoader.loadClass(uri, Procedure.class) ; if ( procedureClass == null ) return null ; // Registry it put(uri, procedureClass) ; attemptedLoads.add(uri) ; // Call again to get it. return registry.get(uri) ; }
public static Class<?> loadClass(String uri, Class<?> expectedClass) { String mappedUri = mapDynamicURI(uri); if (mappedUri == null) return null; return ClsLoader.loadClass(mappedUri, expectedClass); }
public static String mapDynamicURI(String uri) { // Jena2 -> Jena3 transition if ( uri.startsWith("http://jena.hpl.hp.com/ARQ") ) { String newURI = uri.replace("http://jena.hpl.hp.com/", "http://jena.apache.org/") ; Log.warnOnce(MappedLoader.class, "Loading function or property function with old style 'jena.hpl.hp.com' used - preferred style is to use 'jena.apache.org': "+uri+ " => "+newURI, uri) ; } Map.Entry<String, String> e = find(uri); if (e == null) { if (uri.startsWith(ARQConstants.javaClassURIScheme)) return uri; return null; } String k = e.getKey(); String v = e.getValue(); uri = uri.substring(k.length()); uri = v + uri; return uri; }
/** Lookup by URI */ public FunctionFactory get(String uri) { FunctionFactory function = registry.get(uri) ; if ( function != null ) return function ; if ( attemptedLoads.contains(uri) ) return null ; Class<?> functionClass = MappedLoader.loadClass(uri, Function.class) ; if ( functionClass == null ) return null ; // Registry it put(uri, functionClass) ; attemptedLoads.add(uri) ; // Call again to get it. return registry.get(uri) ; }
/** Lookup by URI */ public PropertyFunctionFactory get(String uri) { String mappedUri = MappedLoader.mapDynamicURI(uri) ; if ( mappedUri != null ) uri = mappedUri ; PropertyFunctionFactory ext = registry.get(uri) ; if ( ext != null ) return ext ; if ( attemptedLoads.contains(uri) ) return null ; Class<?> extClass = MappedLoader.loadClass(uri, PropertyFunction.class) ; if ( extClass == null ) return null ; // Register it put(mappedUri, extClass) ; attemptedLoads.add(uri) ; // Call again to get it. return registry.get(uri) ; }