@Test public void testGetResourceParentClassloader() throws MalformedURLException { String testName = "testName"; URL url = new URL( "file: when( parentClassLoader.getResource( testName ) ).thenReturn( url ); assertEquals( url, shimBridgingClassloader.getResource( testName ) ); }
@Override public URL getResource( String name ) { int lastIndexOf = name.lastIndexOf( '/' ); List<URL> entries; if ( lastIndexOf > 0 ) { entries = bundleWiring.findEntries( name.substring( 0, lastIndexOf ), name.substring( lastIndexOf + 1 ), 0 ); } else { entries = bundleWiring.findEntries( "/", name, 0 ); } if ( entries.size() == 1 ) { return entries.get( 0 ); } URL resource = bundleWiringClassloader.getResource( name ); if ( resource == null ) { resource = super.getResource( name ); } return resource; }
ShimBridgingClassloader extends ClassLoader implements BundleReference { @Override public URL getResource( String name ) { int lastIndexOf = name.lastIndexOf( '/' ); List<URL> entries; if ( lastIndexOf > 0 ) { entries = bundleWiring.findEntries( name.substring( 0, lastIndexOf ), name.substring( lastIndexOf + 1 ), 0 ); } else { entries = bundleWiring.findEntries( "/", name, 0 ); } if ( entries.size() == 1 ) { return entries.get( 0 ); } URL resource = bundleWiringClassloader.getResource( name ); if ( resource == null ) { resource = super.getResource( name ); } return resource; } }
ShimBridgingClassloader extends ClassLoader implements BundleReference { @Override public URL getResource( String name ) { int lastIndexOf = name.lastIndexOf( '/' ); List<URL> entries; if ( lastIndexOf > 0 ) { entries = bundleWiring.findEntries( name.substring( 0, lastIndexOf ), name.substring( lastIndexOf + 1 ), 0 ); } else { entries = bundleWiring.findEntries( "/", name, 0 ); } if ( entries.size() == 1 ) { return entries.get( 0 ); } URL resource = bundleWiringClassloader.getResource( name ); if ( resource == null ) { resource = super.getResource( name ); } return resource; } ShimBridgingClassloader( ClassLoader parentClassLoader, BundleContext bundleContext ); }
ShimBridgingClassloader extends ClassLoader implements BundleReference { @Override public URL getResource( String name ) { int lastIndexOf = name.lastIndexOf( '/' ); List<URL> entries; if ( lastIndexOf > 0 ) { entries = bundleWiring.findEntries( name.substring( 0, lastIndexOf ), name.substring( lastIndexOf + 1 ), 0 ); } else { entries = bundleWiring.findEntries( "/", name, 0 ); } if ( entries.size() == 1 ) { return entries.get( 0 ); } URL resource = bundleWiringClassloader.getResource( name ); if ( resource == null ) { resource = super.getResource( name ); } return resource; } ShimBridgingClassloader( ClassLoader parentClassLoader, BundleContext bundleContext ); static Object create( BundleContext bundleContext, String className, List<Object> arguments ); @Override URL getResource( String name ); @Override Class<?> loadClass( String name, boolean resolve ); @Override Bundle getBundle(); }
ShimBridgingClassloader extends ClassLoader implements BundleReference { @Override public URL getResource( String name ) { int lastIndexOf = name.lastIndexOf( '/' ); List<URL> entries; if ( lastIndexOf > 0 ) { entries = bundleWiring.findEntries( name.substring( 0, lastIndexOf ), name.substring( lastIndexOf + 1 ), 0 ); } else { entries = bundleWiring.findEntries( "/", name, 0 ); } if ( entries.size() == 1 ) { return entries.get( 0 ); } URL resource = bundleWiringClassloader.getResource( name ); if ( resource == null ) { resource = super.getResource( name ); } return resource; } ShimBridgingClassloader( ClassLoader parentClassLoader, BundleContext bundleContext ); static Object create( BundleContext bundleContext, String className, List<Object> arguments ); @Override URL getResource( String name ); @Override Class<?> loadClass( String name, boolean resolve ); @Override Bundle getBundle(); static final String HADOOP_SPOON_PLUGIN; }