Skip to content

Commit c49a170

Browse files
marko-kriskovicivicac
authored andcommitted
2282 - added filesystem tools
1 parent 542474c commit c49a170

File tree

9 files changed

+1145
-16
lines changed

9 files changed

+1145
-16
lines changed

server/libs/modules/components/filesystem/src/main/java/com/bytechef/component/filesystem/FilesystemComponentHandler.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.bytechef.component.filesystem;
1818

1919
import static com.bytechef.component.definition.ComponentDsl.component;
20+
import static com.bytechef.component.definition.ComponentDsl.tool;
2021

2122
import com.bytechef.component.ComponentHandler;
2223
import com.bytechef.component.definition.ComponentCategory;
@@ -48,7 +49,15 @@ public class FilesystemComponentHandler implements ComponentHandler {
4849
FilesystemLsAction.ACTION_DEFINITION,
4950
FilesystemReadFileAction.ACTION_DEFINITION,
5051
FilesystemRmAction.ACTION_DEFINITION,
51-
FilesystemWriteFileAction.ACTION_DEFINITION);
52+
FilesystemWriteFileAction.ACTION_DEFINITION)
53+
.clusterElements(
54+
tool(FilesystemCreateTempDirAction.ACTION_DEFINITION),
55+
tool(FilesystemMkdirAction.ACTION_DEFINITION),
56+
tool(FilesystemGetParentFolderAction.ACTION_DEFINITION),
57+
tool(FilesystemLsAction.ACTION_DEFINITION),
58+
tool(FilesystemReadFileAction.ACTION_DEFINITION),
59+
tool(FilesystemRmAction.ACTION_DEFINITION),
60+
tool(FilesystemWriteFileAction.ACTION_DEFINITION));
5261

5362
@Override
5463
public ComponentDefinition getDefinition() {

server/libs/modules/components/filesystem/src/main/java/com/bytechef/component/filesystem/action/FilesystemCreateTempDirAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import static com.bytechef.component.definition.ComponentDsl.sampleOutput;
2222
import static com.bytechef.component.definition.ComponentDsl.string;
2323

24-
import com.bytechef.component.definition.ActionContext;
2524
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
25+
import com.bytechef.component.definition.Context;
2626
import com.bytechef.component.definition.Parameters;
2727
import java.io.File;
2828
import java.io.IOException;
@@ -47,7 +47,7 @@ private FilesystemCreateTempDirAction() {
4747
}
4848

4949
protected static String perform(
50-
Parameters inputParameters, Parameters connectionParameters, ActionContext context) throws IOException {
50+
Parameters inputParameters, Parameters connectionParameters, Context context) throws IOException {
5151

5252
Path path = Files.createTempDirectory("createTempDir_");
5353

server/libs/modules/components/filesystem/src/main/java/com/bytechef/component/filesystem/action/FilesystemGetParentFolderAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import static com.bytechef.component.definition.ComponentDsl.string;
2323
import static com.bytechef.component.filesystem.constant.FilesystemConstants.FILENAME;
2424

25-
import com.bytechef.component.definition.ActionContext;
2625
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
26+
import com.bytechef.component.definition.Context;
2727
import com.bytechef.component.definition.Parameters;
2828
import java.io.File;
2929
import java.nio.file.NoSuchFileException;
@@ -59,7 +59,7 @@ private FilesystemGetParentFolderAction() {
5959
* the text before the last forward or backslash.
6060
*/
6161
protected static String perform(
62-
Parameters inputParameters, Parameters connectionParameters, ActionContext context) throws NoSuchFileException {
62+
Parameters inputParameters, Parameters connectionParameters, Context context) throws NoSuchFileException {
6363
String filename = inputParameters.getRequiredString(FILENAME);
6464
File file = new File(filename);
6565

server/libs/modules/components/filesystem/src/main/java/com/bytechef/component/filesystem/action/FilesystemLsAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import static com.bytechef.component.filesystem.constant.FilesystemConstants.PATH;
2727
import static com.bytechef.component.filesystem.constant.FilesystemConstants.RECURSIVE;
2828

29-
import com.bytechef.component.definition.ActionContext;
3029
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
30+
import com.bytechef.component.definition.Context;
3131
import com.bytechef.component.definition.Parameters;
3232
import java.io.File;
3333
import java.io.IOException;
@@ -74,7 +74,7 @@ private FilesystemLsAction() {
7474
}
7575

7676
protected static List<FileInfo> perform(
77-
Parameters inputParameters, Parameters connectionParameters, ActionContext context) throws IOException {
77+
Parameters inputParameters, Parameters connectionParameters, Context context) throws IOException {
7878

7979
Path root = Paths.get(inputParameters.getRequiredString(PATH));
8080
boolean recursive = inputParameters.getBoolean(RECURSIVE, false);

server/libs/modules/components/filesystem/src/main/java/com/bytechef/component/filesystem/action/FilesystemMkdirAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import static com.bytechef.component.definition.ComponentDsl.string;
2323
import static com.bytechef.component.filesystem.constant.FilesystemConstants.PATH;
2424

25-
import com.bytechef.component.definition.ActionContext;
2625
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
26+
import com.bytechef.component.definition.Context;
2727
import com.bytechef.component.definition.Parameters;
2828
import java.io.IOException;
2929
import java.nio.file.Files;
@@ -57,7 +57,7 @@ private FilesystemMkdirAction() {
5757
* An exception is not thrown if the directory could not be created because it already exists.
5858
*/
5959
protected static String perform(
60-
Parameters inputParameters, Parameters connectionParameters, ActionContext context) throws IOException {
60+
Parameters inputParameters, Parameters connectionParameters, Context context) throws IOException {
6161

6262
return String.valueOf(Files.createDirectories(Paths.get(inputParameters.getRequiredString(PATH))));
6363
}

server/libs/modules/components/filesystem/src/main/java/com/bytechef/component/filesystem/action/FilesystemReadFileAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import static com.bytechef.component.definition.ComponentDsl.string;
2323
import static com.bytechef.component.filesystem.constant.FilesystemConstants.FILENAME;
2424

25-
import com.bytechef.component.definition.ActionContext;
2625
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
26+
import com.bytechef.component.definition.Context;
2727
import com.bytechef.component.definition.FileEntry;
2828
import com.bytechef.component.definition.Parameters;
2929
import java.io.FileInputStream;
@@ -51,7 +51,7 @@ private FilesystemReadFileAction() {
5151
}
5252

5353
protected static FileEntry perform(
54-
Parameters inputParameters, Parameters connectionParameters, ActionContext context)
54+
Parameters inputParameters, Parameters connectionParameters, Context context)
5555
throws IOException {
5656

5757
String filename = inputParameters.getRequiredString(FILENAME);

server/libs/modules/components/filesystem/src/main/java/com/bytechef/component/filesystem/action/FilesystemRmAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import static com.bytechef.component.definition.ComponentDsl.string;
2424
import static com.bytechef.component.filesystem.constant.FilesystemConstants.PATH;
2525

26-
import com.bytechef.component.definition.ActionContext;
2726
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
27+
import com.bytechef.component.definition.Context;
2828
import com.bytechef.component.definition.Parameters;
2929
import java.io.File;
3030
import java.io.IOException;
@@ -63,7 +63,7 @@ private FilesystemRmAction() {
6363
* </p>
6464
*/
6565
protected static Boolean perform(
66-
Parameters inputParameters, Parameters connectionParameters, ActionContext context) {
66+
Parameters inputParameters, Parameters connectionParameters, Context context) {
6767

6868
File file = new File(inputParameters.getRequiredString(PATH));
6969

server/libs/modules/components/filesystem/src/main/java/com/bytechef/component/filesystem/action/FilesystemWriteFileAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import static com.bytechef.component.filesystem.constant.FilesystemConstants.FILENAME;
2727
import static com.bytechef.component.filesystem.constant.FilesystemConstants.FILE_ENTRY;
2828

29-
import com.bytechef.component.definition.ActionContext;
3029
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
30+
import com.bytechef.component.definition.Context;
3131
import com.bytechef.component.definition.Parameters;
3232
import java.io.IOException;
3333
import java.io.InputStream;
@@ -62,7 +62,7 @@ private FilesystemWriteFileAction() {
6262
}
6363

6464
protected static Map<String, ?> perform(
65-
Parameters inputParameters, Parameters connectionParameters, ActionContext context) throws IOException {
65+
Parameters inputParameters, Parameters connectionParameters, Context context) throws IOException {
6666

6767
String fileName = inputParameters.getRequiredString(FILENAME);
6868

0 commit comments

Comments
 (0)