OO wrappers for portable OS commands (eg. OS-DELETE)

Posted by dbeavon on 07-Feb-2019 16:42

Is anyone aware of object-oriented wrapper methods for the portable OS commands (OS-DELETE and similar)?

The usage patterns for those OS-whatever commands is not what someone would expect when writing modern code (OO and SEH).

Take a look at the following from the docs for example:

  • Although an error can occur during execution of this statement, the statement does not generate an error message, raise an error condition, or affect the program's flow in any way

Okay..... who wants to use an API that will quietly fail to do what you ask of it?

This type of API doesn't seem reliable or trustworthy.  I understand that these method calls must be paired up with a following call to the OS-ERROR function, but why make that manual (and optional)?  The worse thing about those subsequent methods to check for errors (eg "OS-ERROR") is that it clutters the code, but if you choose not to do them straight-away then the runtime may overwrite the related details.

An OO-friendly wrapper for this stuff would be greatly appreciated.

All Replies

Posted by oedev on 08-Feb-2019 12:00

Hi

If you only need to support Windows, I'd move away from using OS-DELETE, OS-DIR etc. and use the corresponding commands from the .NET framework which do include proper error handling (e.g. docs.microsoft.com/.../system.io.file.delete

HTH

Posted by Roger Blanchard on 08-Feb-2019 12:21

Agree with oedev...if you are only supporting windows use the .NET equivalent. They perform much better as well or at least some of them. FileInfo for one is much more efficient in the .NET framework.

Posted by dbeavon on 08-Feb-2019 13:46

Thank for the tips.  We are just starting to ramp up our use of the "CLR bridge".  We found & reported a couple of significant issues when using it within PASOE's "ms-agent".  Aside from that, I am very happy with the ability to load and interact with a .Net appdomain whenever we get in a pinch.

But I should point out that we are still straddling two platforms at the moment: Windows and HP-UX.  It might be premature to abandon the portable code altogether.  I suspect it is possible that we will be running OE 11.7.x on HP-UX until the bitter end (2025 or later).

The reason I asked is because I had noticed that the oo-related API's (in ABL) are growing in recent versions of OpenEdge (ie. in the libraries named OpenEdge.Core OpenEdge.BusinessLogic OpenEdge.Net).  These class libraries have a lot of "wrapper" classes to encapsulate the legacy stuff and make it more accessible to modern code.  I was hoping someone knew of some "wrapper" classes for portable interaction with the file system.  

On that note, it is very hard for me to "visualize" the scope of the classes that are available in recent versions of the OpenEdge libraries.  Is there a diagram that corresponds to the available classes?  ie. from the following links (oe 11.6 and oe 11.7):


https://documentation.progress.com/output/oehttpclient/116/index.html 
https://documentation.progress.com/output/oehttpclient/117/index.html 

(I haven't found the documentation for classes in earlier versions  - I need them back to oe 11.3).  

In theory I could use the docs to generate my own diagrams but I was hoping someone had already done that.  I believe OE 11.3 only had very little other than some HTTP primitives from "OpenEdge.Net".  Subsequent versions of OE have expanded on that.

This thread is closed