If I'm using a Thing based on RemoteThingWithFileTransfer and want to delete a file on my edge device, I seem to need to provide both the virtual path (which in my case is /incoming/) plus the filename, e.g. myFile.wmv.
But the DeleteFile service only accepts one parameter: path.
If I hook up ListFiles, then display the result of that in a list from which the user can select one file, then try to use that selected item as the path param to DeleteFile, it doesn't work... I can only feed it path or name--not both. If I feed it ListFiles.selectedRows.name, I see an error because I'm only providing the name (not the path). If I provide ListFiles.selectedRows.path, it fails because I don't provide a file.
The only way I can see DeleteFile work at all is if I DON'T feed it any dynamic input (have no data binding to it), and manually enter '/incoming/myFile.wmv' in the path field in ThingWorx Composer's lower right panel. So... DeleteFile seems to only work if you can concatenate the virtual directory and the filename and provide that concatenated string as the value of the single param, path.
But how can I do that in ThingWorx Composer? I.e. how can I tell it to use basically the result of the string concatenation '/incoming/' + ListFiles.selectedRows.path as the input for DeleteFile?
Do I actually need to be overriding DeleteFile in Java code I'd write for the edge device? Background: I have been brought in to try to finish a project a former employee of this client started. That employee DID work on both the mashups in Composer as well as Java code for the edge device. At the moment though the client has only provide me access in ThingWorx Composer, plus one hardware test unit. I can get into that test unit and browse around the filesystem and see their _compiled_ edge device application stuff, and the directory that maps to virtual directory /incoming/ but I don't have the client's original Java source code yet.
When you do a DeleteFile request on a RemoteThing that includes File Transfer functionality, it will be looking in the defined Remote File Repositories, you will need to look at the configuration of the Thingworx Edge MicroServer. Then you'll use the Alias, whatever path within the alias and the file name.
So let's say the remote repository is defined as MyRemoteRepo : "/path/"
You'd delete from MyRemoteRepo/whateversubfoldersdefined/filetodelete.fileextension
Thanks for your response Pai...
So, for the 'path' attribute of DeleteFile (the only attribute there is), I would need to pass in any subdirectory plus the actual filename within that subdirectory?
If so, that means somehow I need to be able to concatenate the subdirectory and the filename, doesn't it? From my call to ListFiles (if I want to let a user pick the file from a list), I get separate path and file fields back, but no full file path. So I'm not sure how to specify in the path attribute of DeleteFile that the single path attribute there should contain the concatenated string to provide both a subdirectory and the specific filename.
Sorry if I'm missing something.
I should probably add that our company has also bought a license for Thingworx but we haven't installed a system of our own yet. That's under the e-mail of our VP of sales, firstname.lastname@example.org I have gone through the ThingWorx EMS demo at http://www.thingworx.com/developer/device-kits/pc-ems and saw the web interface to control the device. The mashup however never seemed to connect to it. Both were running in Chrome on the same Windows 64-bit laptop, and I'd installed the PCEMS.exe file.
I'm a little unsure about whether I'm getting the right documentation to seriously get started... if I need to install the PTC ELEARNING LIBRARIES locally to access the real documentation for a newbie.
But to go back to this particular client I'm attempting to help... they have a startup script that I believe starts the WebSockets EMS on their linux edge unit. Note that I don't see a /MicroServer/ directory anywhere on that unit... so their system diverges from what I read in things like the ThingWorx WebSocket-Based Edge MicroServer User's Guide. I think that it is running the EMS though, because from a mashup I see whether the particular unit is connected. I can browser files on it from a mashup, I can choose a file and tell the unit to play it (if it's a video) on the unit.
And I can delete a file from a mashup but only if I manually concatenate the virtual path and the filename in the data panel in the lower right of ThingWorx Composer for DeleteFile's 'path' field.
I'm trying to get the three .java files the client created which will doubtless help, but am waiting on them. But the way their EMS stuff seems to be launched from a script called ems.sh on the unit boils down to this line that runs it as a Java application:
java -cp “$fileList” (classpath to the various ThingWorx jar files)
com.<customer>.RefreshClient (path to their ‘main’ class--I've just changed their company name here in this posting to <customer>)
/opt/Refresh (directory that maps to the local repository? ‘/incoming/‘ seems to map to /opt/Refresh/Videos/Shared/ which seems to be connected because I see the files in there from a mashup)
/opt/Refresh/Database/refresh_database.db (local db)
So, currently I'm looking at DeleteFile, which I will need, but my bigger goal is to get File Upload to the unit working. I can--from a mashup--choose a file on my laptop where I'm viewing a mashup in my Chrome browser and press the upload button. I see progress go up to 100% but then I always get an error. I also don't think the service on the edge unit is working because when I open the debug/trace window, I never see any indication that that file upload service has been called. I.e. I don't see Service Parameters showing values, and I don't see a green icon in the upper-right corner of that section of the debug window. For all the other services I call, I do see a green icon, and number of times the service has been invoked.
It seems like I'm probably only uploading the file to <customer>-sandbox.cloud.thingworx.com but that then the ThingWorx server cannot connect to the File Upload service on my edge device to really push it out. But I'm not sure if that's the correct interpretation of what I see.