This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch pf in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1d25c19a25489ff4006e5098868c418d153e4c89 Author: Claus Ibsen <[email protected]> AuthorDate: Tue Feb 15 09:52:27 2022 +0100 CAMEL-17647: camel-core - Properties component should support pluggable functions --- .../camel/spi/annotations/PropertiesFunction.java | 33 +++++++++++++++++++++ .../camel/spi/PropertiesFunctionFactory.java | 34 ++++++++++++++++++++++ .../camel/maven/packaging/SpiGeneratorMojo.java | 9 +----- 3 files changed, 68 insertions(+), 8 deletions(-) diff --git a/core/camel-api/src/generated/java/org/apache/camel/spi/annotations/PropertiesFunction.java b/core/camel-api/src/generated/java/org/apache/camel/spi/annotations/PropertiesFunction.java new file mode 100644 index 0000000..7e9e966 --- /dev/null +++ b/core/camel-api/src/generated/java/org/apache/camel/spi/annotations/PropertiesFunction.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.spi.annotations; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Target({ ElementType.TYPE }) +@ServiceFactory("properties-function") +public @interface PropertiesFunction { + + String value(); + +} diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/PropertiesFunctionFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/PropertiesFunctionFactory.java new file mode 100644 index 0000000..53045b3 --- /dev/null +++ b/core/camel-api/src/main/java/org/apache/camel/spi/PropertiesFunctionFactory.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.spi; + +/** + * Pluggable Factory for creating custom {@link PropertiesFunction}. + */ +public interface PropertiesFunctionFactory { + + /** + * Service factory key. + */ + String FACTORY = "properties-function-factory"; + + /** + * Creates the {@link PropertiesFunction} + */ + PropertiesFunction createPropertiesFunction(); + +} diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpiGeneratorMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpiGeneratorMojo.java index 3e23588..80f7f19 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpiGeneratorMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpiGeneratorMojo.java @@ -112,14 +112,7 @@ public class SpiGeneratorMojo extends AbstractGeneratorMojo { } // - // @ServiceFactory - // @SubServiceFactory - // - // @CloudServiceFactory - // @Component - // @Dataformat - // @Language - // @SendDynamic + // @ServiceFactory and children // for (AnnotationInstance sfa : index.getAnnotations(SERVICE_FACTORY)) { if (sfa.target().kind() != Kind.CLASS || sfa.target().asClass().nestingType() != NestingType.TOP_LEVEL) {
