1

I've started a project, it's a web application to let the world listen all of my personnal songs. So far, all the songs available on the website are stored in war/songs. Then, my database only stores the path to this file and that works really nicely.

I wanted to created a web page only accessible to admin (basically me :D) to upload my songs at this location, so I don't have to deploy the entire project just to add a song ... And I am now reading that it's impossible in app engine ? I don't think storing the songs in the database is a good idea ?

Can I have you thoughts on my issue ? Thanks a lot !

Also, if app engine is not suited to my goal, I wanted to know some good place to host my java application ... that seems quite rare !

Thanks again ..

Farid
  • 1,472
  • 2
  • 17
  • 25
  • I dont understand your question quite well due to my poor english. Wat do u want to do exactly? Storing songs but these songs only accessibe to yourself? Maybe you should take a look at Google Storage. @zacheusz 's Blobstore solution is good too. Uploading to Google Storage is much more convenient than uploading to Blobstore. – DocWiki Jul 09 '11 at 21:14

2 Answers2

6

It is possible on GAE. Simply you have to store your files in Blobstore, not in filesystem. Instead of path you could use blob key. You can upload your files like this:

<body>
<form action="<%= blobstoreService.createUploadUrl("/upload") %>" method="post" enctype="multipart/form-data">
    <input type="file" name="myFile">
    <input type="submit" value="Submit">
</form>

And you can set in web.xml constraint to prevent access to your site:

<security-constraint>
    <web-resource-collection>
        <url-pattern>/admin/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>admin</role-name>
    </auth-constraint>
</security-constraint>

And then to serve file from servlet:

public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException {
    BlobKey blobKey = new BlobKey(req.getParameter("blob-key"));
    blobstoreService.serve(blobKey, res);
zacheusz
  • 8,415
  • 3
  • 32
  • 57
2

I am really surprised that IBM is such a big fan of Google. I have found quite an amount of IBM published literature pertaining to Google technologies. Hmmm .... why?

Anyway,

  1. What is good for IBM is good for me: http://www.ibm.com/developerworks/java/library/j-gaestorage/

  2. What is good for Google is good for me, too. Google doesn't want you to store your files in a "file system". They want you to use their map reduced storage.

You are mistaken - google repository technology is superior to your perception of "file system". First of all, you need to read up on OS principles especially on the "file system" section. A file system is a map to a blob.

GAE is a cloud. "CLOUD" - not desktop, nor web server, nor db server, nor a round-robbin of multiple discrete servers. Cloud vs server is akin to analogue vs discrete ICs, continuum cumulative intelligence (some people "misnomerously" call it fuzzy logic) vs discrete if-then-else logic, quantum dynamics vs newtonian mechanics.

Continuum (or at least what the cloud attempts to be). In a continuum (or an attempt at continuum), you cannot store your "files".

You are outdated. No, pardon me, you are not outdated - since there are many bleeding-edge technologies that do not involve the cloud. Anyway, whatever you read about traditional "databases" and "file systems" cannot apply to the cloud continuum. In the Cloud continuum resources shift, consumers/clients shift.

Google cloud storage is not traditional databases. They are architected and tuned for shifty players.

What is a cloud? When you make a telephone call or digital connection from Kansas City, MO to Cairo, Egypt, the routers look for the best route for you. The best route for you? No, but the best route that maximises their profits. It could go thro undersea cables, satellites, uncharted domains, etc, constantly shifting and reconfigured. It could take a longer route for a few moments of your conversation/connection because it was cheaper. It's the good old terminology called "virtual".

You can't possibly depend on a traditional "file system" for such a shifty virtual world. You could mount a crusade/jihad and insist just as some kooks are mounting campaigns to demolish the global virtual financial system by insisting that monetary values be backed by "real" gold, in vain.

Whether Google storage, bigtable, Amazon simple db, etc, they are all akin to a "file system" map, except being configured to function on a shifty cloud. So, enjoy the cloud and store your "files" as assets on the cloud.

Humans evolve, with the rest of the Universe. Evolution is the Voice of Gd and right now the Cloud is the next stage of human evolution since the advent of the printing press. You will be assimilated - resistance is futile. You want your files to be backed by "real gold" servers? Even "gold" is a derivative value and is a virtual asset, like the value of the Mona Lisa. And so is the security/stability perception you have of "real" file systems.

Blessed Geek
  • 19,240
  • 21
  • 96
  • 165