Trying to upload a file into google app engine using Blob - google-app-engine

I am trying to upload the file into google app engine from where I would like to retrieve it and then perform conversion into a pdf file. I want to have a cloud access so I am deploying this project. But I dont the best way to go about it. Can anyone help please ? Or is there any solution to directly convert the file while being on the server ?

I don't think there are any ways to convert a file directly on the server. But to store and retrieve, you might want to take a look into the Google Cloud Storage client library (and the one from Python, if needed).
These might help as well (Java and Python). From there you can easily save a file, then retrieve it. Once you retrieve it, do your conversion to pdf and voila!

Related

What is the best way to store data from my repository?

I'm building a website with a "repository" where the user can download and upload several files of different sizes. My idea is to use my database with metadata to store information (extension, some tags and the path where it is stored). And then the user can access this data or search the application. My problem is that I don't know the best way to store it, I thought of using google drive, S3 and dropbox through API's. But I would like to know other ways to make this possible. I know it's a complex subject, but I would like you to tell me where to study.
for storing metadata you can use mongodb sync with file id and for storing large file you can use google drive API (let me know if you intrested ) or some kind of file hosting.

Make epub programmatically in app engine?

I'm developing a web service in App Engine standard environment with Java (servlets).
The idea is that it get info. from Cloud SQL and generate a EPUB programmatically with Siegmann' epub library: http://www.siegmann.nl/epublib
But i'm not sure that how can add things like images or html files (i first will convert the info. from Cloud SQL to HTML), sicen the writer of epub needs a path to a files.
can i download first all resources that need in local directory of app engine and references them?
Or what can i do?
Thank you in advance and sorry for my English.
Option 1:
You can use the /tmp directory of your App Engine instance to store temporary files. See this link.
Bear in mind that files stored in the /tmp folder will only be accessible within the instance that wrote them.
Option 2:
After a quick look to Siegmann' epub library, I have seen that resources can be provided as Byte arrays and the writer fills an OutputStream.
With this in mind, you could use Cloud Storage and it's Java Client Library to download and store the files.
In this Java sample from the docs, you can see that an object is up laded without the need of it being stored in file-system, just passing it as Byte array.
And to download files from Cloud Storage into the memory of your App Engine App, you could use storage.get(BlobId.of(bucketName, objectName)).getContent() to get the object's byte array

Edit server-side file using GWT

I'm new to GWT. I need to read a text file from the server, display its content in a TextArea widget, allow the user to modify it, and save the updated file back to the server. Can anyone please tell me, is it possible, and what should be the right way to do this?
It is possible.
You can make a service to access the file (read and write) and the GWT client will easily call the service methods and update the user interface (TextArea).
Read here for more details.
Also you can start right away by making a new GWT project in Eclipse and choose to generate sample code. It will generate a simple service and simple GWT page that calls the service. You can add your methods to this service to try it out as a proof of concept.
If you are using Google App Engine server, there's no way to write file to server because of restriction.
To write file to server, you will need to create your own server, create a service (use Java or another server-side language) then use one of these methods to communicate with your server.
If you still want to use GAE server (on appspot.com domain), you can use another method to store your data like Datastore or Google Cloud Storage, see this article for more information.

App Engine: Can I upload my local dev_appserver.datastore to the live datastore?

I've been reading about the remote_api and the bulkloader.yaml configuration file for doing bulk uploads of Google App Engine, but all I really want to do is replace my live datastore on the cloud with the contents of my local datastore. From what I've read, it would seem that I have to first somehow convert my dev_appserver.datastore file into csv or xml, and then apply all the fancy transforms of bulkloader.yaml, which seems like a lot of unnecessary work.
Anyone know if there's an easier way?
Thanks!
It might work to run download_data against localhost and then upload_data, using that dump, against your live app... does it?

Developing for Google App Engine and using the datastore

I am just getting started with Google Web Toolkit and Google App Engine and have a quick question. I think I understand how to use the datastore now but I was wondering if there is a way that I can quickly create a "database" with static data from an excel sheet? I just need to add some data for a proof of concept later this week.
I am picturing something similar to a SQL database browser where I can just import the data?
I developing in Eclipse with appropriate plugins.
Thanks,
Rob
The easiest way to do this would be to save your spreadsheet as a CSV file, then use the bulkloader to load it into the datastore.
Your best bet is probably to write something to handle uploading it, or to handle processing it on the server.
However, you should also look at the bulk loader. It might be able to save you a little bit of time.
Here is the API (Google Documents List API) that "allows client applications to programmatically access and manipulate user data stored with Google Documents".

Resources