This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch lan-markup
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 75eba9d7e9b9e5163a152cc9c6b8ef90d2f1f7d0
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Fri Aug 16 12:35:42 2024 +0200

    CAMEL-20569: camel-catalog - Markup languages which functions they support 
for better doc and tooling.
---
 .../org/apache/camel/language/simple/file.json     | 17 +++++++
 .../modules/languages/pages/file-language.adoc     |  2 +-
 .../camel/language/simple/FileConstants.java       | 59 ++++++++++++++++++++++
 .../apache/camel/language/simple/FileLanguage.java |  2 +-
 4 files changed, 78 insertions(+), 2 deletions(-)

diff --git 
a/core/camel-core-languages/src/generated/resources/META-INF/org/apache/camel/language/simple/file.json
 
b/core/camel-core-languages/src/generated/resources/META-INF/org/apache/camel/language/simple/file.json
index 83d94c000d3..e0c81a04934 100644
--- 
a/core/camel-core-languages/src/generated/resources/META-INF/org/apache/camel/language/simple/file.json
+++ 
b/core/camel-core-languages/src/generated/resources/META-INF/org/apache/camel/language/simple/file.json
@@ -20,5 +20,22 @@
     "expression": { "index": 1, "kind": "value", "displayName": "Expression", 
"group": "common", "required": true, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The expression value in your chosen language syntax" },
     "resultType": { "index": 2, "kind": "attribute", "displayName": "Result 
Type", "group": "common", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Sets the class of the result type (type from output)" },
     "trim": { "index": 3, "kind": "attribute", "displayName": "Trim", "group": 
"advanced", "label": "advanced", "required": false, "type": "boolean", 
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": true, "description": "Whether to trim the 
value to remove leading and trailing whitespaces and line breaks" }
+  },
+  "functions": {
+    "file:name": { "index": 0, "kind": "function", "displayName": "File", 
"group": "function", "label": "function", "required": false, "javaType": 
"String", "prefix": "${", "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "The file name (relative 
from starting directory)", "suffix": "}" },
+    "file:name.noext": { "index": 1, "kind": "function", "displayName": 
"File", "group": "function", "label": "function", "required": false, 
"javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": 
"", "autowired": false, "secret": false, "description": "The file name 
(relative from starting directory) without extension", "suffix": "}" },
+    "file:name.noext.single": { "index": 2, "kind": "function", "displayName": 
"File", "group": "function", "label": "function", "required": false, 
"javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": 
"", "autowired": false, "secret": false, "description": "The file name 
(relative from starting directory) without extension. If the file name has 
multiple dots, then this expression strips and only returns the last part.", 
"suffix": "}" },
+    "file:name.ext": { "index": 3, "kind": "function", "displayName": "File", 
"group": "function", "label": "function", "required": false, "javaType": 
"String", "prefix": "${", "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "The file extension", 
"suffix": "}" },
+    "file:name.ext.single": { "index": 4, "kind": "function", "displayName": 
"File", "group": "function", "label": "function", "required": false, 
"javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": 
"", "autowired": false, "secret": false, "description": "The file extension. If 
the file extension has multiple dots, then this expression strips and only 
returns the last part.", "suffix": "}" },
+    "file:onlyname": { "index": 5, "kind": "function", "displayName": "File", 
"group": "function", "label": "function", "required": false, "javaType": 
"String", "prefix": "${", "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "\u2020he file name 
(without any leading paths)", "suffix": "}" },
+    "file:onlyname.noext": { "index": 6, "kind": "function", "displayName": 
"File", "group": "function", "label": "function", "required": false, 
"javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": 
"", "autowired": false, "secret": false, "description": "\u2020he file name 
(without any leading paths) without extension", "suffix": "}" },
+    "file:onlyname.noext.single": { "index": 7, "kind": "function", 
"displayName": "File", "group": "function", "label": "function", "required": 
false, "javaType": "String", "prefix": "${", "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": false, "description": 
"\u2020he file name (without any leading paths) without extension. If the file 
name has multiple dots, then this expression strips and only returns the last 
part.", "suffix": "}" },
+    "file:parent": { "index": 8, "kind": "function", "displayName": "File", 
"group": "function", "label": "function", "required": false, "javaType": 
"String", "prefix": "${", "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "The file parent directory 
(null if no parent directory)", "suffix": "}" },
+    "file:path": { "index": 9, "kind": "function", "displayName": "File", 
"group": "function", "label": "function", "required": false, "javaType": 
"String", "prefix": "${", "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "The file path", "suffix": 
"}" },
+    "file:absolute": { "index": 10, "kind": "function", "displayName": "File", 
"group": "function", "label": "function", "required": false, "javaType": 
"boolean", "prefix": "${", "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "Whether the file is 
regarded as absolute or relative", "suffix": "}" },
+    "file:absolute.path": { "index": 11, "kind": "function", "displayName": 
"File", "group": "function", "label": "function", "required": false, 
"javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": 
"", "autowired": false, "secret": false, "description": "The absolute file 
path", "suffix": "}" },
+    "file:length": { "index": 12, "kind": "function", "displayName": "File", 
"group": "function", "label": "function", "required": false, "javaType": 
"long", "prefix": "${", "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "The size of the file", 
"suffix": "}" },
+    "file:size": { "index": 13, "kind": "function", "displayName": "File", 
"group": "function", "label": "function", "required": false, "javaType": 
"long", "prefix": "${", "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "The size of the file", 
"suffix": "}" },
+    "file:modified": { "index": 14, "kind": "function", "displayName": "File", 
"group": "function", "label": "function", "required": false, "javaType": 
"long", "prefix": "${", "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "The file modification 
date", "suffix": "}" }
   }
 }
diff --git 
a/core/camel-core-languages/src/main/docs/modules/languages/pages/file-language.adoc
 
b/core/camel-core-languages/src/main/docs/modules/languages/pages/file-language.adoc
index bab3431944f..e8ae85b3f78 100644
--- 
a/core/camel-core-languages/src/main/docs/modules/languages/pages/file-language.adoc
+++ 
b/core/camel-core-languages/src/main/docs/modules/languages/pages/file-language.adoc
@@ -60,7 +60,7 @@ directory, see note below)
 
 |file:name.noext.single |String |yes |no |yes |no |refers to the file name 
with no extension (is
 relative to the starting directory, see note below). If the file
-extension has multiple dots, then this expression strips only the last
+name has multiple dots, then this expression strips only the last
 part, and keeps the others.
 
 |file:onlyname |String |yes |no |yes |no |refers to the file name only with no 
leading paths.
diff --git 
a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/FileConstants.java
 
b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/FileConstants.java
new file mode 100644
index 00000000000..d093c39e34b
--- /dev/null
+++ 
b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/FileConstants.java
@@ -0,0 +1,59 @@
+/*
+ * 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.language.simple;
+
+import org.apache.camel.spi.Metadata;
+
+@Metadata(label = "function", annotations = { "prefix=${", "suffix=}" })
+public final class FileConstants {
+
+    @Metadata(description = "The file name (relative from starting 
directory)", javaType = "String", label = "function")
+    public static final String FILE_NAME = "file:name";
+    @Metadata(description = "The file name (relative from starting directory) 
without extension", javaType = "String",
+              label = "function")
+    public static final String FILE_NO_EXT = "file:name.noext";
+    @Metadata(description = "The file name (relative from starting directory) 
without extension. If the file name has multiple dots, then this expression 
strips and only returns the last part.",
+              javaType = "String", label = "function")
+    public static final String FILE_NO_EXT_SINGLE = "file:name.noext.single";
+    @Metadata(description = "The file extension", javaType = "String", label = 
"function")
+    public static final String FILE_EXT = "file:name.ext";
+    @Metadata(description = "The file extension. If the file extension has 
multiple dots, then this expression strips and only returns the last part.",
+              javaType = "String", label = "function")
+    public static final String FILE_EXT_SINGLE = "file:name.ext.single";
+    @Metadata(description = "†he file name (without any leading paths)", 
javaType = "String", label = "function")
+    public static final String FILE_ONLY_NAME = "file:onlyname";
+    @Metadata(description = "†he file name (without any leading paths) without 
extension", javaType = "String",
+              label = "function")
+    public static final String FILE_ONLY_NAME_NO_EXT = "file:onlyname.noext";
+    @Metadata(description = "†he file name (without any leading paths) without 
extension. If the file name has multiple dots, then this expression strips and 
only returns the last part.",
+              javaType = "String", label = "function")
+    public static final String FILE_ONLY_NAME_NO_EXT_SINGLE = 
"file:onlyname.noext.single";
+    @Metadata(description = "The file parent directory (null if no parent 
directory)", javaType = "String", label = "function")
+    public static final String FILE_PARENT = "file:parent";
+    @Metadata(description = "The file path", javaType = "String", label = 
"function")
+    public static final String FILE_PATH = "file:path";
+    @Metadata(description = "Whether the file is regarded as absolute or 
relative", javaType = "boolean", label = "function")
+    public static final String FILE_ABSOLUTE = "file:absolute";
+    @Metadata(description = "The absolute file path", javaType = "String", 
label = "function")
+    public static final String FILE_ABSOLUTE_PATH = "file:absolute.path";
+    @Metadata(description = "The size of the file", javaType = "long", label = 
"function")
+    public static final String FILE_LENGTH = "file:length";
+    @Metadata(description = "The size of the file", javaType = "long", label = 
"function")
+    public static final String FILE_SIZE = "file:size";
+    @Metadata(description = "The file modification date", javaType = "long", 
label = "function")
+    public static final String FILE_MODIFIED = "file:modified";
+}
diff --git 
a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/FileLanguage.java
 
b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/FileLanguage.java
index 83b535c9f82..f579745e989 100644
--- 
a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/FileLanguage.java
+++ 
b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/FileLanguage.java
@@ -21,7 +21,7 @@ import org.apache.camel.spi.annotations.Language;
 /**
  * The Camel file language.
  */
-@Language("file")
+@Language(value = "file", functionsClass = FileConstants.class)
 public class FileLanguage extends SimpleLanguage {
 
     public FileLanguage() {

Reply via email to