@Test public void loadSuselPropertiesTest() throws Exception { SuselMetadataLoader loader = new SuselMetadataLoader(); var holder = loader.load(this.getClass()); assertNotNull(holder.properties().getProperty("com.example.MyServiceImpl_Refs"), "Susel properties should be loaded and 'com.example.MyServiceImpl_Refs' key should have a value"); }
public <S> Metadata load(Class<S> serviceProvider) throws IOException, SuselMetadataNullException { var module = serviceProvider.getModule(); var metadata = perModuleMetadataCache.get(module); if (metadata != null) { return metadata; } synchronized (LOCK) { metadata = perModuleMetadataCache.get(module); if (metadata == null) { var properties = new Properties(); try (InputStream inStream = serviceProvider.getModule().getResourceAsStream(SUSEL_METADATA_RESOURCE_PATH)) { properties.load(inStream); } catch (NullPointerException ex) { throw new SuselMetadataNullException(ex); } metadata = new Metadata(module, properties); perModuleMetadataCache.put(module, metadata); } } return metadata; }
SuselMetadataLoader { public <S> Metadata load(Class<S> serviceProvider) throws IOException, SuselMetadataNullException { var module = serviceProvider.getModule(); var metadata = perModuleMetadataCache.get(module); if (metadata != null) { return metadata; } synchronized (LOCK) { metadata = perModuleMetadataCache.get(module); if (metadata == null) { var properties = new Properties(); try (InputStream inStream = serviceProvider.getModule().getResourceAsStream(SUSEL_METADATA_RESOURCE_PATH)) { properties.load(inStream); } catch (NullPointerException ex) { throw new SuselMetadataNullException(ex); } metadata = new Metadata(module, properties); perModuleMetadataCache.put(module, metadata); } } return metadata; } }
SuselMetadataLoader { public <S> Metadata load(Class<S> serviceProvider) throws IOException, SuselMetadataNullException { var module = serviceProvider.getModule(); var metadata = perModuleMetadataCache.get(module); if (metadata != null) { return metadata; } synchronized (LOCK) { metadata = perModuleMetadataCache.get(module); if (metadata == null) { var properties = new Properties(); try (InputStream inStream = serviceProvider.getModule().getResourceAsStream(SUSEL_METADATA_RESOURCE_PATH)) { properties.load(inStream); } catch (NullPointerException ex) { throw new SuselMetadataNullException(ex); } metadata = new Metadata(module, properties); perModuleMetadataCache.put(module, metadata); } } return metadata; } SuselMetadataLoader(); }
SuselMetadataLoader { public <S> Metadata load(Class<S> serviceProvider) throws IOException, SuselMetadataNullException { var module = serviceProvider.getModule(); var metadata = perModuleMetadataCache.get(module); if (metadata != null) { return metadata; } synchronized (LOCK) { metadata = perModuleMetadataCache.get(module); if (metadata == null) { var properties = new Properties(); try (InputStream inStream = serviceProvider.getModule().getResourceAsStream(SUSEL_METADATA_RESOURCE_PATH)) { properties.load(inStream); } catch (NullPointerException ex) { throw new SuselMetadataNullException(ex); } metadata = new Metadata(module, properties); perModuleMetadataCache.put(module, metadata); } } return metadata; } SuselMetadataLoader(); Metadata load(Class<S> serviceProvider); }
SuselMetadataLoader { public <S> Metadata load(Class<S> serviceProvider) throws IOException, SuselMetadataNullException { var module = serviceProvider.getModule(); var metadata = perModuleMetadataCache.get(module); if (metadata != null) { return metadata; } synchronized (LOCK) { metadata = perModuleMetadataCache.get(module); if (metadata == null) { var properties = new Properties(); try (InputStream inStream = serviceProvider.getModule().getResourceAsStream(SUSEL_METADATA_RESOURCE_PATH)) { properties.load(inStream); } catch (NullPointerException ex) { throw new SuselMetadataNullException(ex); } metadata = new Metadata(module, properties); perModuleMetadataCache.put(module, metadata); } } return metadata; } SuselMetadataLoader(); Metadata load(Class<S> serviceProvider);  }