New version of SimpleStorage and other updates
Quite a lot of new code got piled up so without further ado here are the news.
(You can get all new releases from the download page)
SimpleStorage
This a new major release (1.7.3) of SimpleStorage. And sadly also a breaking one. At least if you were writing your own filters and adapters. There was no other way around if I wanted to write a good and clean code. All changes that were made revolve around filters and adapters. Here is the list of important changes
- Filters were extended to the document level. This means you can now compress and encrypt XML nodes or whole document in a transparent manner.
- Chaining was introduced to filters. This means you can now encrypt and compress a document in a single step or if you like, in a single line of code
- Encryption and compression are now integral part of SimpleStorage and no third party components are needed anymore.
- Adapters and Filter now use cleaner approach, so no more strings as identifiers, to specify which filter or adapter you want.
Let me give you some examples:
Compressing and the encrypting a whole document.
NormalXML.Filter(ZLIB).Filter(XTEA('MyStrongKey')).SaveToFile(FilteredXMLFileTwo);
The same but using a document fiter chain interface.
DocumentFilterChain := CreateDocumentFilterChain; DocumentFilterChain.AddFilter(CompressedStorage); DocumentFilterChain.AddFilter(EncryptedStorage('MyStrongKey')); NormalXML := DocumentFilterChain.LoadFromFile(FilteredXMLFileOne); NormalXML.SaveToFile(NormalXMLFileOne);
Compressing using the compressed storage interface.
CompressedStorage.SaveToFile(DecompressedXML, CompressedXMLFileOne);
Compressing using the build in ZLIB filter.
DecompressedXML.Filter(ZLIB).SaveToFile(CompressedXMLFileTwo);
Do you see how simple it is to compress and encrypt a XML document. The other change is in the adapter code. There are no more strings to specify which adapter to use. It looks like this:
SS.Ensure('MemTable').Adapter(DataSet).Load(ClientDS);
and
SS.Get('MemTable').Adapter(DataSet).Save(ClientDS);
There are other smaller changes, but this are the major ones. Just a warning here. If you were writing adapters or filters (your own) then this is a breaking release and you will have to update your code to the new specifications. The examples that come withe the library are clear enough that it should be a breeze. For normal user nothing changes and the code will stay the same. I also left the old version of SimpleStorage available for download if people don’t want to upgrade right away.
Also I would like to announce that I will begin writing basic documentation for SimpleStorage.
ISAPIServer
This is a new component in the library. It is a standalone ISAPI server capable of processing Delphi ISAPI modules. You don’t need Apache or IIS. And it is build in the way, that you can use your favorite HTTP library to use it. It comes with already made bindings for Indy, but it would be equally simple to do bindings for Synapse or ICS. This is possible because it is designed in a very modular way. If any of you are interested in that, you can contact me and I can help with it. I am posting the whole ISAPI request code for Indy as an example:
procedure TfMain.HTTPServerCommandGet({$IFDEF Indy9} AThread: TIdPeerThread; {$ELSE} AContext: TIdContext; {$ENDIF} ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo); var ECB: TECBData; Port: string; TempStr: string; PathStr: string; RootDir: string; DDLFileName: string; begin TempStr := Copy(ARequestInfo.Document, 2, Length(ARequestInfo.Document)); RootDir := IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))); PathStr := '/' + StrAfter('/', TempStr); DDLFileName := StrBefore('/', TempStr); {$IFDEF Indy9} Port := IntToStr(AThread.Connection.Socket.Binding.Port); {$ELSE} Port := IntToStr(AContext.Binding.Port); {$ENDIF} ECB := ECBDataList.AcquireNewECB; try FillECBFromRequest(ECB, HTTPServer.KeepAlive, ARequestInfo, RootDir, DDLFileName, Port, PathStr); try FISAPIServer.Execute(DDLFileName, ECB); finally FillResponseFromECB(ECB, AResponseInfo); end; finally ECBDataList.DeleteECB(ECB.ECB.ConnID); end; end;
RoboMailer
This is also a new component. It is intended as a simplified mass mailer component. It can also be used to send a single mail easily with no worries on how to set everything up correctly. It comes with a demo application, which can send mass mails. You can personify each mail with the data you provide. Maybe it will be of use to somebody. It uses ICS as an engine.
Threading unit
This unit got two interesting additions. First one is a lock free stack based on the windows API. No home made code here, just a wrapper around windows API. And the second one is a thread safe queue. It uses critical sections but tries to lock as little as possible. I have done some tests and it is very fast. In fact it is almost as fast as a lock free one, but the code is much much simpler. There is very little difference in speed in fact it is negligible in real world problems.
ChangleLog:
- 1.4.0
- Added TLockFreeStack based on Windows SLISTS
- Added TThreadSafeQueue based on linked lists
- 1.3.7
- Added ShutdownTimeout (INFINITE by default)
- Wait for all tasks to finish then shutting down the task pool
CRON Scheduler
Change Log:
- 2.0.3
- added HasValue function for TChronEntry
SimpleLog
Change Log:
- 1.2.0
- Use the new rewritten Cromis.Exceptions
- Log file limit is now working correctly
XTEA
Change Log:
- 1.1.0
- Added overloaded procedures for stream and file encryption / decryption
Azrael11 wrote,
Can i have the load time of a xml file to a progressbar? SimpleStorage
Link | May 26th, 2011 at 11:38 am
Iztok Kacin wrote,
I don’t think so. If you were having in mind to show a progress bar while parsing the document. Why would you like to do that, is parsing taking so long?
Link | May 26th, 2011 at 11:43 am
Azrael11 wrote,
Yes about one minute it is a 50 mb xml file
Link | May 26th, 2011 at 1:19 pm
Iztok Kacin wrote,
Hm, yes, that is a lot. I would have to ask the author of OmniXML, but I see the problem, because at the time of parsing you have no idea about the structure of the XML. Probably it could be done in a sense that it would return the percent of bytes parsed. But this is only approximation, you cannot be completely accurate.
Link | May 26th, 2011 at 1:22 pm
Azrael11 wrote,
Yes that is my problem… it is been so relief if at least show the progress in a Tprogressbar…
Link | May 26th, 2011 at 1:25 pm
Azrael11 wrote,
If you have news about that please sent me an e-mail
Thank you very much for your help…
Link | May 26th, 2011 at 1:26 pm
Menjanahary R. R wrote,
It would be nice if you add a rich constructor allowing the creation of an xml document given also a processing instruction (PI).
Thank you.
Link | April 7th, 2012 at 2:19 pm
Iztok Kacin wrote,
I am thinking of exposing XML document as a property. I have no intention of supporting all XML related properties as SimpleStorage is about storing and manipulation data in XML. However I see the importance to be able to set processing instructions and other XML related tasks. I think exposing XML document as property is the best way to go. I will look how to do it in a transparent way.
My biggest goal with SimpleStorage is to make it a independent set of interfaces for storing and manipulating data. This way you could write your binary data implementation and still use the same interfaces for it.
Link | April 9th, 2012 at 9:43 am