TIL: Derby can store and serve Classes from Jars !?

Hiya Guys,

Well, it’s been a while since I’ve last been on the forumns, and longer still since I’ve been able to find time to have fun with JME… sigh. Well, life threw an odd ball situation at me, and now I am running a small computer repair store in Guymon.

Whilst working on a web project for a local school, I learned that Derby (an SQL database that automatically comes with Glassfish) can also store Jars… and serve classes from inside of them. I don’t know how I came across the info, it was probably a mis-click whilst looking for other information. Still, I found it, read it, and proceeded to drool.

The link for further reading:
http://db.apache.org/derby/docs/10.6/devguide/cdevdeploy856753.html

So, why did I post this? Well, as a wannabe game dev, I knew right off the bat that this was a great way to serve out new or temporary content straight from a server. One of my dreams is to have a system where users can create their own content and store it on a Server. This system would allow such content to be “streamed” dynamically from the web without having to store it on the user’s computer. Of course, once the “preview” is complete, it would be no problem to actually d/l the JAR in it’s entirety and store it locally if that is what the programmer desires.

So updates, hotfixes, and possibly DRM coordination from a Derby database? Well, that seems pretty cool to me. I learned that, today, and I wanted to toss it out here in the forums as a “heads up.” I have to head back to my web programming (oh, and check out “Primefaces Showcase” as a search term in google) and I hope to become a regular here at the forums once I get some time cleared and get back on the Tonegod GUI Visual Editor that I have planned.

Game On,
Charles Anderson

How would you prevent users from uploading malicious content? Would you run it in some kind of a sandbox?

He could do it the same way Steam Workshop does it. I’m not sure how exactly that all works though.

Indeed, no one could stop users from uploading malicious content. That will always be a risk, and there are already popular strategies for handling this. The key thing to remember is: “Yes, they can upload it. But, that doesn’t mean we have to immediately make it available for popular download.”

The strategy that I want to employ is to provide tools to import data only assets like audio, textures, and meshes with company generated template code to bring in the data, and let the artists see how it works in the game. A sandbox situation for the data. The biggest thing to worry about is mostly offensive/immature/copyrighted content. A report button usually handles this kind of thing, and this is primarily the User Generated content I had in mind.

But yeah, mods are where the programmers get to shine, huh?

The thing most people are afraid of is that which can potentially come from an evil mod. MUAHAHAHAHA! and other such evilness. Well, the strategy I plan to employ is the trustee system. First timers get to have a review period where we look for those beautiful odd system calls, and other such nonsense. We can make it easy for the honest ones by supplying a good API and a clear game subfolder for them to work with. The biggest thing is to have the review/testing downloads separate from the approved/popular downloads…

So yeah, sandbox type installation deal is a decent strat. Code Review is safest and most boring. Brave beta testers from forums are the most exciting, though…

And ALWAYS have that report button ready, just in case. :wink:

Oh and the standard legal disclaimer “We didn’t write it personally, so we ain’t taking responsibility for it. If it don’t work right, let us know, and we’ll get the pooper scooper out on that pile o’ :hankey:

I think that’s the usual strategy in a nutshell. At least that’s what I’ve seen happening in most situations. Most people like making cool/awesome stuff, and we just have to keep an eye out for the dodgy stuff as best we can without making it a total pain in the butt for the honest ones.

Game On,
Charles Anderson

You just need to declare your own ClassLoader to do this. Check out Hotbeans at GitHub if you’re interested. I’ve been thinking about it a couple of times. Easy way to imolement dynamic Java code during runtime.

We use this kind of things at work when we build state machines for different things and doesen’t want to restart servers when deploying new stuff.

1 Like

BTw you do not have to use derby for this (it has its problems)

I would actually keep the jars in your case, one mod one jar, and done, makes updating stuff way more straight forward.

1 Like

Yeah, “where to store the jars” seems like a tiny part of the larger problem. Like, I don’t know why a file system and a web server isn’t fine for serving jars. Seems the DB will just add unnecessary overhead in this case. Even something like S3 is just a flat store that you’d index in some other way.

Not to poo-poo your long post… just seems that storing jars in a DB doesn’t really offer many advantages over way simpler methods.

1 Like

I completely agree.

I was thinking more of artistic assets and streaming them to a game in a kind of preformatted Youtube-ish style. It doesn’t serve the entire jar as a file, from my reading of the documentation… it streams out the pertinent class files and assets from the stored jar file in the configuration that they described. So… uh… yeah, code and asset streaming…

Hm it does, actually, backup the db and you are done is the main one. (I have my artifactory working completly db based)

Also you get stronger constraints there, nothing like the file for this mod could not be found on disk.

But I don#t really see the advantage of loading every class one by one from the server, instead of downloading the jar and load it all at once.

Maybee this comes from my childhood, where stable and fast internet connections were a dream. Anyway you have to deal with tons of strange errors if you use a web classloader, like connection drops.

Eg. I play 1 hour, then open a gui and it tries to download the class for that.