You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "jamesnetherton (via GitHub)" <gi...@apache.org> on 2023/06/21 06:21:28 UTC

[GitHub] [camel-quarkus] jamesnetherton opened a new pull request, #5001: Remove Spring dependencies from Jira extension

jamesnetherton opened a new pull request, #5001:
URL: https://github.com/apache/camel-quarkus/pull/5001

   (no comment)


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #5001: Remove Spring dependencies from Jira extension

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on code in PR #5001:
URL: https://github.com/apache/camel-quarkus/pull/5001#discussion_r1236602911


##########
extensions/jira/deployment/src/main/java/org/apache/camel/quarkus/component/jira/deployment/JiraProcessor.java:
##########
@@ -80,4 +87,38 @@ List<ReflectiveClassBuildItem> registerReflectiveClasses() {
         items.add(ReflectiveClassBuildItem.builder("org.codehaus.jettison.json.JSONObject").methods(true).build());
         return items;
     }
+
+    @BuildStep(onlyIf = IsSpringBeansAbsent.class)
+    void generateDisposableInterface(BuildProducer<GeneratedClassBuildItem> generatedClass) {
+        // TODO: remove if https://ecosystem.atlassian.net/browse/JRJC-258 eventually gets fixed
+        try (ClassCreator classCreator = ClassCreator.interfaceBuilder()
+                .className(DISPOSABLE_BEAN_CLASS_NAME)
+                .classOutput(new GeneratedClassGizmoAdaptor(generatedClass, false))
+                .build()) {
+
+            /*
+             * Original implementation of DisposableBean is:
+             *
+             * public interface DisposableBean {
+             *   void destroy() throws Exception;
+             * }
+             */
+            try (MethodCreator methodCreator = classCreator.getMethodCreator("destroy", void.class)) {
+                methodCreator.setModifiers(Modifier.PUBLIC | Modifier.ABSTRACT);
+                methodCreator.addException(Exception.class);
+            }
+        }
+    }
+
+    static final class IsSpringBeansAbsent implements BooleanSupplier {
+        @Override
+        public boolean getAsBoolean() {
+            try {
+                Class.forName(DISPOSABLE_BEAN_CLASS_NAME);

Review Comment:
   Done



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #5001: Remove Spring dependencies from Jira extension

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on code in PR #5001:
URL: https://github.com/apache/camel-quarkus/pull/5001#discussion_r1236580058


##########
extensions/jira/deployment/src/main/java/org/apache/camel/quarkus/component/jira/deployment/JiraProcessor.java:
##########
@@ -80,4 +87,38 @@ List<ReflectiveClassBuildItem> registerReflectiveClasses() {
         items.add(ReflectiveClassBuildItem.builder("org.codehaus.jettison.json.JSONObject").methods(true).build());
         return items;
     }
+
+    @BuildStep(onlyIf = IsSpringBeansAbsent.class)
+    void generateDisposableInterface(BuildProducer<GeneratedClassBuildItem> generatedClass) {
+        // TODO: remove if https://ecosystem.atlassian.net/browse/JRJC-258 eventually gets fixed
+        try (ClassCreator classCreator = ClassCreator.interfaceBuilder()
+                .className(DISPOSABLE_BEAN_CLASS_NAME)
+                .classOutput(new GeneratedClassGizmoAdaptor(generatedClass, false))
+                .build()) {
+
+            /*
+             * Original implementation of DisposableBean is:
+             *
+             * public interface DisposableBean {
+             *   void destroy() throws Exception;
+             * }
+             */
+            try (MethodCreator methodCreator = classCreator.getMethodCreator("destroy", void.class)) {
+                methodCreator.setModifiers(Modifier.PUBLIC | Modifier.ABSTRACT);
+                methodCreator.addException(Exception.class);
+            }
+        }
+    }
+
+    static final class IsSpringBeansAbsent implements BooleanSupplier {
+        @Override
+        public boolean getAsBoolean() {
+            try {
+                Class.forName(DISPOSABLE_BEAN_CLASS_NAME);

Review Comment:
   Yes. Let me do that :+1: 



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on a diff in pull request #5001: Remove Spring dependencies from Jira extension

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on code in PR #5001:
URL: https://github.com/apache/camel-quarkus/pull/5001#discussion_r1236569715


##########
extensions/jira/deployment/src/main/java/org/apache/camel/quarkus/component/jira/deployment/JiraProcessor.java:
##########
@@ -80,4 +87,38 @@ List<ReflectiveClassBuildItem> registerReflectiveClasses() {
         items.add(ReflectiveClassBuildItem.builder("org.codehaus.jettison.json.JSONObject").methods(true).build());
         return items;
     }
+
+    @BuildStep(onlyIf = IsSpringBeansAbsent.class)
+    void generateDisposableInterface(BuildProducer<GeneratedClassBuildItem> generatedClass) {
+        // TODO: remove if https://ecosystem.atlassian.net/browse/JRJC-258 eventually gets fixed
+        try (ClassCreator classCreator = ClassCreator.interfaceBuilder()
+                .className(DISPOSABLE_BEAN_CLASS_NAME)
+                .classOutput(new GeneratedClassGizmoAdaptor(generatedClass, false))
+                .build()) {
+
+            /*
+             * Original implementation of DisposableBean is:
+             *
+             * public interface DisposableBean {
+             *   void destroy() throws Exception;
+             * }
+             */
+            try (MethodCreator methodCreator = classCreator.getMethodCreator("destroy", void.class)) {
+                methodCreator.setModifiers(Modifier.PUBLIC | Modifier.ABSTRACT);
+                methodCreator.addException(Exception.class);
+            }
+        }
+    }
+
+    static final class IsSpringBeansAbsent implements BooleanSupplier {
+        @Override
+        public boolean getAsBoolean() {
+            try {
+                Class.forName(DISPOSABLE_BEAN_CLASS_NAME);

Review Comment:
   Is it better to load class with TCCL?
   ```suggestion
                   Class.forName(DISPOSABLE_BEAN_CLASS_NAME, true, 
    Thread.currentThread().getContextClassLoader());
   ```



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton merged pull request #5001: Remove Spring dependencies from Jira extension

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton merged PR #5001:
URL: https://github.com/apache/camel-quarkus/pull/5001


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org