Skip to content

Commit

Permalink
replace deprecated MCRConfiguration2.getInstanceOf(...) #85
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteph-de committed Oct 16, 2024
1 parent 409593e commit 977cb8b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

public class MCRDiskcacheDownloadServlet extends FileServlet {
private static final long serialVersionUID = 1L;
private MCRIDMapper mcrIdMapper = MCRConfiguration2
.<MCRIDMapper>getInstanceOf(MCRIDMapper.MCR_PROPERTY_CLASS).get();

private MCRIDMapper mcrIdMapper
= MCRConfiguration2.getInstanceOf(MCRIDMapper.class, MCRIDMapper.MCR_PROPERTY_CLASS).get();

@Override
public void init() throws ServletException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ private MCRDiskcacheManager() {
MCRConfiguration2.getString("MCR.Diskcache.EnabledCaches").ifPresent(x -> {
Arrays.asList(x.split(",")).forEach(c -> {
caches.put(c,
MCRConfiguration2.<MCRDiskcacheConfig>getInstanceOf(MCR_PROPERTY_CONFIG_PREFIX + c + ".Class")
MCRConfiguration2.getInstanceOf(MCRDiskcacheConfig.class, MCR_PROPERTY_CONFIG_PREFIX + c + ".Class")
.orElseThrow(() -> MCRConfiguration2
.createConfigurationException(MCR_PROPERTY_CONFIG_PREFIX + c + ".Class")));
});
LOGGER.warn("Info: DiskCacheConfiguration loaded");
LOGGER.warn("-----------------------------------");
for (Entry<String, MCRDiskcacheConfig> e : caches.entrySet()) {
DiskLruCache c = e.getValue().getCache();
String size = c == null ? "null" : Long.toString(c.size());
LOGGER.warn(e.getKey() + ":: urlSuffix: " + e.getValue().getURLSuffix()
+ " / cacheObject: " + c
+ " / currentCacheSize: " + c == null ? "null" : Long.valueOf(c.size()));
+ " / currentCacheSize: " + size);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public class MCRJSPDocportalIRCommands extends MCRAbstractCommands {
"./mods:recordInfo/mods:recordInfoNote[@type='k10plus_ppn']",
Filters.element(), null, MODS_NAMESPACE);

private static MCRMODSCatalogService MODS_CATALOG_SERVICE = (MCRMODSCatalogService) MCRConfiguration2
.getInstanceOf("MCR.Workflow.MODSCatalogService.class").orElse(null);
private static MCRMODSCatalogService MODS_CATALOG_SERVICE = MCRConfiguration2
.getInstanceOf(MCRMODSCatalogService.class, "MCR.Workflow.MODSCatalogService.class").orElse(null);

/**
* Update the MODS metadata of the given object with data from catalog
Expand Down

0 comments on commit 977cb8b

Please sign in to comment.