Skip to content

Commit 3b350e8

Browse files
A little cleanup in resource source registration
1 parent 7735b38 commit 3b350e8

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

ng-appserver/src/main/java/ng/appserver/NGApplication.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public static <E extends NGApplication> E runAndReturn( final String[] args, fin
146146
try {
147147
NGApplication application = applicationClass.getDeclaredConstructor().newInstance();
148148

149-
addDeprecatedDefaultResourceSources( application.resourceManager() );
149+
addDefaultResourceSourcesDeprecated( application.resourceManager() );
150150

151151
// FIXME: Assigning that unwanted global application...
152152
_application = application;
@@ -291,7 +291,7 @@ private void locatePlugins() {
291291
*/
292292
private void initPlugin( final NGPlugin plugin ) {
293293
logger.info( "Initializing plugin {}", plugin.getClass().getName() );
294-
addDefaultResourcesourcesForNamespace( resourceManager().resourceLoader(), plugin.namespace() );
294+
addDefaultResourcesourcesForNamespace( resourceManager(), plugin.namespace() );
295295
properties().addAndReadSource( new PropertiesSourceResource( plugin.namespace(), "Properties" ) );
296296

297297
// FIXME: We're greedily loading everything now. We need to modify element loading and caching to make it dynamic during development // Hugi 2025-04-19
@@ -623,21 +623,23 @@ public NGSession createSessionForRequest( NGRequest request ) {
623623
}
624624

625625
/**
626-
* CHECKME: These is for registering the "unnamespaced" resource locations we started out with. They'll still work fine, but we'll need to consider their future and should probably be deleted // Hugi 2024-06-19
626+
* CHECKME: Registers the "unnamespaced" resource locations we started out with. They'll still work fine, but we'll need to consider their future. They should probably be deleted // Hugi 2024-06-19
627627
*/
628628
@Deprecated
629-
private static void addDeprecatedDefaultResourceSources( final NGResourceManager resourceManager ) {
629+
private static void addDefaultResourceSourcesDeprecated( final NGResourceManager resourceManager ) {
630630
final NGResourceLoader loader = resourceManager.resourceLoader();
631-
loader.addResourceSource( StandardNamespace.App.identifier(), StandardResourceType.App, new JavaClasspathResourceSource( "app-resources" ) );
632-
loader.addResourceSource( StandardNamespace.App.identifier(), StandardResourceType.WebServer, new JavaClasspathResourceSource( "webserver-resources" ) );
633-
loader.addResourceSource( StandardNamespace.App.identifier(), StandardResourceType.Public, new JavaClasspathResourceSource( "public" ) );
634-
loader.addResourceSource( StandardNamespace.App.identifier(), StandardResourceType.ComponentTemplate, new JavaClasspathResourceSource( "components" ) );
631+
final String namespace = StandardNamespace.App.identifier();
632+
loader.addResourceSource( namespace, StandardResourceType.App, new JavaClasspathResourceSource( "app-resources" ) );
633+
loader.addResourceSource( namespace, StandardResourceType.WebServer, new JavaClasspathResourceSource( "webserver-resources" ) );
634+
loader.addResourceSource( namespace, StandardResourceType.ComponentTemplate, new JavaClasspathResourceSource( "components" ) );
635+
loader.addResourceSource( namespace, StandardResourceType.Public, new JavaClasspathResourceSource( "public" ) );
635636
}
636637

637638
/**
638-
* Declare resource sources for the standard resource types in the given namespace
639+
* Declare resource sources for standard resource types in the given namespace
639640
*/
640-
private static void addDefaultResourcesourcesForNamespace( final NGResourceLoader loader, final String namespace ) {
641+
private static void addDefaultResourcesourcesForNamespace( final NGResourceManager resourceManager, final String namespace ) {
642+
final NGResourceLoader loader = resourceManager.resourceLoader();
641643
loader.addResourceSource( namespace, StandardResourceType.App, new JavaClasspathResourceSource( "ng/%s/app-resources".formatted( namespace ) ) );
642644
loader.addResourceSource( namespace, StandardResourceType.WebServer, new JavaClasspathResourceSource( "ng/%s/webserver-resources".formatted( namespace ) ) );
643645
loader.addResourceSource( namespace, StandardResourceType.ComponentTemplate, new JavaClasspathResourceSource( "ng/%s/components".formatted( namespace ) ) );

0 commit comments

Comments
 (0)