Closed woolfel closed 8 years ago
As I remember, temporary folder is mostly used for merging json and resources into a single zip. So to get rid of it, you should form a signed zip in memory. Wouldn't it be more costly in terms of memory?
It would. Especially since you have to keep the entire template in memory, too.
totally agree could have a significant performance impact. Under load, it could cause major heap thrashing. I mentioned it for a few reasons. Some corporate environments use VM, but the storage isn't configured optimally, so writing to JVM temp directory might be a SAN/NAS. Clearly the better solution is to configure the VM to use a fast local disk, but often that is beyond the control of the developers. It's an idea, but probably not applicable or desirable for most production environments where the setup uses local disk for JVM temp folder.
I've done a first step in that general direction. Generating the files in memory isn't officially supported yet, but you can sign a manifest file in memory now. See https://github.com/drallgood/jpasskit/blob/master/jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKAbstractSIgningUtil.java
And of course, you're now able to also hold templates in memory.
There are still a lot of missing pieces, though (namely generating json files and creating the zip file)
I think I've done it. Not sure it's worth doing, but it wasn't all that hard ;)
cool, I'll have to try it out.
Guess this is working?
I was looking at how pkpass files are created and noticed it writes manifest.json and pass.json to JVM's temp folder. Some of our customers use virtual machines, so there might be corporate policies about using JVM temp folder. If I read the code correctly there's only a few places where it uses jackson to write to a file. Alternatively, it could write to a string instead.
I'd be happy to make the enhancement if others think that is a desirable feature.
thanks