davsclaus commented on code in PR #10268:
URL: https://github.com/apache/camel/pull/10268#discussion_r1219601027


##########
dsl/camel-xml-io-dsl/src/main/java/org/apache/camel/dsl/xml/io/XmlRoutesBuilderLoader.java:
##########
@@ -236,4 +215,93 @@ private void 
addConfigurations(RouteConfigurationsDefinition configurations) {
             }
         };
     }
+
+    @Override
+    protected void doStop() throws Exception {
+        resourceCache.clear();
+        xmlInfoCache.clear();
+    }
+
+    private Resource resource(Resource resource) {
+        return resourceCache.computeIfAbsent(resource.getLocation(), l -> new 
CachedResource(resource));
+    }
+
+    private XmlStreamInfo xmlInfo(Resource resource) {
+        return xmlInfoCache.computeIfAbsent(resource.getLocation(), l -> {
+            try {
+                // instead of parsing the document NxM times (for each 
namespace x root element combination),
+                // we preparse it using XmlStreamDetector and then parse it 
fully knowing what's inside.
+                // we could even do better, by passing already preparsed 
information through config file, but
+                // it's getting complicated when using multiple files.
+                XmlStreamDetector detector = new 
XmlStreamDetector(resource.getInputStream());
+                return detector.information();
+            } catch (IOException e) {
+                XmlStreamInfo invalid = new XmlStreamInfo();
+                invalid.setProblem(e);
+                return invalid;
+            }
+        });
+    }
+
+    private void registerBeans(Resource resource, BeansDefinition app) {
+        // <component-scan> - discover and register beans directly with Camel 
injection
+        List<String> packagesToScan = new ArrayList<>();

Review Comment:
   I wonder if this should be a Set to avoid potential duplicate package names 



##########
core/camel-core-model/src/main/java/org/apache/camel/model/app/BeansDefinition.java:
##########
@@ -75,7 +75,8 @@ public class BeansDefinition {
 
     // this is the only way I found to generate usable Schema without imports, 
while allowing elements
     // from different namespaces
-    @ExternalSchemaElement(names = { "bean", "alias" }, namespace = 
"http://www.springframework.org/schema/beans";,
+    @ExternalSchemaElement(names = { "beans", "bean", "alias" },

Review Comment:
   What does alias do here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to