ale89e1 |
Newbie |
|
|
|
|
None Specified |
|
Tuesday, December 15, 2015 |
Tuesday, December 15, 2015 2:23:46 PM |
1 [0.01% of all post / 0.00 posts per day] |
|
I', new to Mapforce and I'm trying to create a simple java function, but when i add its, mapforce tells me:
Quote:"The function 'FilesFromDirectory.filesfromdirectory' will not be available for the builtin execution engine. The return type 'xs:string' of 'result' is invalid!"
What did I do wrong?
This is my code:
FilesFromDirectory.mfd
Code:<?xml version="1.0" encoding="UTF-8"?> <mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http:// www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="mff.xsd" version="8" library="FilesFromDirectory"> <implementations> <implementation language="java"> <setting name="package" value="FilesFromDirectory.FilesFromDirectory.getFilesName"/> <setting name="class" value="FilesFromDirectory"/> </implementation> </implementations> <group name="string functions"> <component name="filesfromdirectory"> <sources> <datapoint name="folder" type="xs:string"/> </sources> <targets> <datapoint name="result" type="xs:string"/> </targets> <implementations> <implementation language="java"> <function name="FilesFromDirectoryFunction"/> </implementation> </implementations> <description> <short>filesname = filesfromdirectory(folder)</short> <long>Returns folder's filename.</long> </description> </component> </group> </mapping>
FilesFromDirectory.java:
Code:public class FilesFromDirectory {
public static String getFilesName(String folder) throws IOException{ ArrayList<Path> listOfFiles = new ArrayList<Path>(); Files.walk(Paths.get(folder)).forEach(filePath -> { if(Files.isRegularFile(filePath)){ listOfFiles.add(filePath.getFileName()); } }); System.out.println("Numero File Trovati: " + listOfFiles.size()); for(int i=0;i<listOfFiles.size();i++) System.out.println(listOfFiles.get(i)); return listOfFiles.toString(); } }
|
|